Skip to content

Commit

Permalink
little ui improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoDoreto committed Apr 7, 2024
1 parent 6ee989f commit 70d0a13
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
11 changes: 10 additions & 1 deletion app/components/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@ interface RadioButtonProps {
name: string;
value: string;
checked: boolean;
className?: string;
onChange: () => void;
}

export function RadioButton({
name,
value,
checked,
className,
onChange,
}: RadioButtonProps) {
return (
<label className="has-[:checked]:bg-green hover:bg-green cursor-pointer px-2 rounded">
<label
className={[
className,
"bg-royal has-[:checked]:bg-green hover:bg-green cursor-pointer rounded flex items-center justify-center",
]
.filter(Boolean)
.join(" ")}
>
{value}
<input
type="radio"
Expand Down
10 changes: 6 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function Home() {
}, []);

return (
<main className="bg-marine flex min-h-screen flex-col items-center justify-between p-12">
<main className="bg-marine flex min-h-screen flex-col items-center justify-between">
<svg viewBox="0 0 1250 1500" style={{ maxHeight: "calc(100vh - 200px)" }}>
<g transform="translate(175,-700)">
<SvgCourt />
Expand All @@ -35,26 +35,28 @@ export default function Home() {
</g>
</svg>

<div className="w-full flex flex-col gap-4">
<div className="flex justify-between">
<div className="w-full flex flex-col gap-4 p-6">
<div className="flex gap-2 items-stretch h-10">
{AllRotations.map((value) => (
<RadioButton
name="rotation"
value={value}
key={value}
checked={rotation === value}
onChange={() => setRotation(value)}
className="grow"
/>
))}
</div>
<div className="flex justify-between">
<div className="flex gap-2 items-stretch h-10">
{AllStances.map((value) => (
<RadioButton
name="stance"
value={value}
key={value}
checked={stance === value}
onChange={() => setStance(value)}
className="grow"
/>
))}
</div>
Expand Down
3 changes: 3 additions & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const config: Config = {
royal: "rgb(31,83,154)",
yellow: "rgb(245,200,82)",
},
minHeight: {
screen: "100dvh",
},
},
},
plugins: [],
Expand Down

0 comments on commit 70d0a13

Please sign in to comment.