Skip to content

Commit

Permalink
Dynamically size answers for small screens
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAman62 committed Aug 26, 2024
1 parent b2c71f3 commit f089db6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
11 changes: 9 additions & 2 deletions ui/src/grid/InteractiveGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ export default function InteractiveGrid({ grid, onCorrect, onIncorrect }: Props)
{category.answers.map((word, j) => {
const color = "bg-green-700 text-white";
return (
<div key={j} className={`flex-1 grow rounded-lg content-center font-bold ${color}`}>
<div
key={j}
className={`flex-1 grow rounded-lg content-center font-bold ${
word.length > 7 ? "text-[0.6rem]" : "text-sm"
} md:text-lg ${color}`}
>
{word}
</div>
);
Expand All @@ -75,7 +80,9 @@ export default function InteractiveGrid({ grid, onCorrect, onIncorrect }: Props)
return (
<button
key={j}
className={`flex-1 grow rounded-lg content-center font-semibold text-[0.6rem] md:text-lg ${color}`}
className={`flex-1 grow rounded-lg content-center font-semibold ${
word.length > 7 ? "text-[0.6rem]" : "text-sm"
} md:text-lg ${color}`}
onClick={() => toggleSelected(word)}
>
{word}
Expand Down
16 changes: 10 additions & 6 deletions ui/src/timer-battle/TimerBattleScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export default function TimerBattleScreen() {
sendMessage("EndRound");
};

const isHost = battle?.players.find((x) => x.name.toUpperCase() === username.toUpperCase())?.isHost === true;

if (battle.state === "InProgress") {
return (
<div className="flex flex-col grow mb-4">
Expand Down Expand Up @@ -84,12 +86,14 @@ export default function TimerBattleScreen() {
</div>
))}

<div className="flex flex-col content-center text-center justify-between w-36 border-2 px-2 pt-1 pb-2 rounded-lg">
<h3 className="text-sm font-semibold">Host Controls</h3>
<Button onClick={endRound} size="xs" color="red">
End Round
</Button>
</div>
{isHost && (
<div className="flex flex-col content-center text-center justify-between w-36 border-2 px-2 pt-1 pb-2 rounded-lg">
<h3 className="text-sm font-semibold">Host Controls</h3>
<Button onClick={endRound} size="xs" color="red">
End Round
</Button>
</div>
)}
</div>
</div>
</div>
Expand Down

0 comments on commit f089db6

Please sign in to comment.