Skip to content

Commit

Permalink
chore: migrated eval bars to tailwindcss
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjosethomas committed Nov 2, 2024
1 parent 9c73096 commit ebb18c4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ export const HorizontalEvaluationBar: React.FC<Props> = ({
width = Math.max(0, Math.min(100, width))

return (
<div className={styles.container}>
<p className={styles.label}>{label}</p>
<div className={styles.content} style={{ width: `${width}%` }} />
<div className="relative flex h-6 w-[75vh] max-w-[70vw] flex-col justify-center overflow-hidden rounded-sm bg-engine-1">
<div className="absolute left-0 top-0 z-0 h-full w-full bg-black bg-opacity-40" />
<p className="z-10 ml-2 whitespace-nowrap text-sm">{label}</p>
<div
className="absolute bottom-0 left-0 z-0 h-full w-full transform rounded-r-sm bg-engine-1 duration-300"
style={{ width: `${width}%` }}
/>
</div>
)
}
10 changes: 7 additions & 3 deletions src/components/VerticalEvaluationBar/VerticalEvaluationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ export const VerticalEvaluationBar: React.FC<Props> = ({
const height = ((value ?? min - min) / (max - min)) * 100

return (
<div className={styles.container}>
<p className={styles.label}>{label}</p>
<div className={styles.content} style={{ height: `${height}%` }} />
<div className="relative flex h-[75vh] max-h-[70vw] w-6 flex-col justify-end overflow-hidden rounded-sm bg-human-4">
<div className="absolute left-0 top-0 z-0 h-full w-full bg-black bg-opacity-40" />
<p className="z-10 mb-2 -rotate-90 whitespace-nowrap text-sm">{label}</p>
<div
className="absolute bottom-0 left-0 z-0 h-full w-full transform rounded-t-sm bg-human-3 duration-300"
style={{ height: `${height}%` }}
/>
</div>
)
}
2 changes: 1 addition & 1 deletion src/pages/analysis/[...id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const Analysis: React.FC<Props> = ({
<div>
<VerticalEvaluationBar
value={moveEvaluation?.maiaWr}
label="Maia Probability"
label="Maia White Win %"
/>
</div>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/pages/train.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ const Train: React.FC<Props> = ({
<div>
<VerticalEvaluationBar
value={moveEvaluation?.maia}
label="Maia Probability"
label="Maia White Win %"
/>
</div>
<div
Expand Down

0 comments on commit ebb18c4

Please sign in to comment.