-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: more UI updates and package upgrades
- Loading branch information
1 parent
feb837f
commit cde3374
Showing
5 changed files
with
341 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Button, Card, CardBody, CardFooter, CardHeader, Typography } from "@material-tailwind/react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { AttemptBadge } from "@components/AttemptBadge/AttemptBadge.tsx"; | ||
import { DifficultyChip } from "@components/DifficultyChip/DifficultyChip.tsx"; | ||
import { QuizRating } from "@components/QuizRating/QuizRating.tsx"; | ||
import { TimeLimitChip } from "@components/TimeLimitChip/TimeLimitChip.tsx"; | ||
import { Difficulty } from "@generated/graphql"; | ||
|
||
interface CountryQuizCardProps { | ||
id: string; | ||
title: string; | ||
description: string; | ||
image: string; | ||
difficulty?: Difficulty; | ||
timeLimit?: number; | ||
} | ||
|
||
export const CountryQuizCard = ({ id, image, title, description, difficulty, timeLimit }: CountryQuizCardProps) => { | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<Card | ||
className="w-full max-w-[20rem] border border-gray-200 shadow-lg" | ||
onClick={() => navigate(`/game/quiz/${id}`)} | ||
> | ||
<CardHeader floated={false} color="blue-gray" className="flex items-center justify-center pt-3"> | ||
<img src={image} alt="the background for the quiz" className="h-40" /> | ||
<div className="to-bg-black-10 absolute inset-0 h-full w-full bg-gradient-to-tr from-transparent via-transparent to-black/60 " /> | ||
<div className="!absolute bottom-2 left-2"> | ||
<QuizRating quizId={id} /> | ||
</div> | ||
<div className="!absolute right-2 top-2"> | ||
<AttemptBadge quizId={id} /> | ||
</div> | ||
</CardHeader> | ||
<CardBody className="flex-grow"> | ||
<div className="mb-3 flex items-center justify-start"> | ||
<Typography variant="h5" color="blue-gray" className="font-medium"> | ||
{title} | ||
</Typography> | ||
</div> | ||
<Typography color="gray" className="break-words"> | ||
{description} | ||
</Typography> | ||
<div className="mt-4 flex flex-wrap gap-3"> | ||
<DifficultyChip difficulty={difficulty} /> | ||
<TimeLimitChip timeLimit={timeLimit || 0} /> | ||
</div> | ||
</CardBody> | ||
<CardFooter className="px-6 pb-4 pt-0"> | ||
<Button size="md" color="blue" fullWidth={true} onClick={() => navigate(`/game/quiz/${id}`)}> | ||
Go to quiz | ||
</Button> | ||
</CardFooter> | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.