Skip to content

Commit 96fd4f7

Browse files
committed
Add score bar
1 parent 2c50c9a commit 96fd4f7

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

website/src/components/posts/CollegeAdmissions/essay/EssayContainer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export default function EssayContainer() {
186186
return (
187187
<div className="essay-container">
188188
<div className="essay-container essay-background">
189+
<div>The score is {essayScore.toFixed(2)}</div>
189190
<div>
190191
<ScoreBar essayScore={essayScore} />
191192
</div>
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import React from "react";
2+
import "./essay.css";
23

34
export default function ScoreBar(props) {
5+
const scale = 2;
6+
const shift = 0;
7+
let scaledScore = props.essayScore * scale + shift;
8+
scaledScore = scaledScore < 0 ? 0 : scaledScore > 100 ? 100 : scaledScore;
9+
410
return (
5-
<div>The score is {props.essayScore.toFixed(2)} (Will be a bar later)</div>
11+
<div class="score-bar">
12+
<div class="score-bar-circle" style={{ left: scaledScore + "%" }}></div>
13+
</div>
614
);
715
}

website/src/components/posts/CollegeAdmissions/essay/essay.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@
1111
border-radius: 15px;
1212
}
1313

14+
.score-bar {
15+
display: block;
16+
height: 5px;
17+
width: 450px;
18+
background: white;
19+
position: relative;
20+
margin-top: 15px;
21+
margin-bottom: 15px;
22+
}
23+
24+
.score-bar-circle {
25+
position: absolute;
26+
height: 20px;
27+
width: 20px;
28+
border-radius: 10px;
29+
background: black;
30+
left: 50%;
31+
top: -7.5px;
32+
}
33+
1434
.written-essay {
1535
margin: 2vh 0;
1636
background-color: white;

0 commit comments

Comments
 (0)