From 0397b7f034360508ec89ab4decbbe8d027af26ac Mon Sep 17 00:00:00 2001 From: Viktor Svertoka Date: Wed, 14 Jan 2026 01:45:40 +0200 Subject: [PATCH] feat(ui): add theme-aware button styles with accent colors --- frontend/app/globals.css | 38 ++++++++----- frontend/components/quiz/QuizCard.tsx | 81 ++++++++++++++------------- 2 files changed, 67 insertions(+), 52 deletions(-) diff --git a/frontend/app/globals.css b/frontend/app/globals.css index fd85b602..b25f8169 100644 --- a/frontend/app/globals.css +++ b/frontend/app/globals.css @@ -7,19 +7,7 @@ --color-foreground: var(--foreground); --font-sans: var(--font-geist-sans); --font-mono: var(--font-geist-mono); - --color-sidebar-ring: var(--sidebar-ring); - --color-sidebar-border: var(--sidebar-border); - --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); - --color-sidebar-accent: var(--sidebar-accent); - --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); - --color-sidebar-primary: var(--sidebar-primary); - --color-sidebar-foreground: var(--sidebar-foreground); - --color-sidebar: var(--sidebar); - --color-chart-5: var(--chart-5); - --color-chart-4: var(--chart-4); - --color-chart-3: var(--chart-3); - --color-chart-2: var(--chart-2); - --color-chart-1: var(--chart-1); + --color-ring: var(--ring); --color-input: var(--input); --color-border: var(--border); @@ -44,7 +32,7 @@ --animate-pulse-soft: pulse-soft 2.8s ease-in-out infinite; } -:root { +@theme { --radius: 0.625rem; --background: oklch(1 0 0); --foreground: oklch(0.145 0 0); @@ -77,6 +65,9 @@ --sidebar-accent-foreground: oklch(0.205 0 0); --sidebar-border: oklch(0.922 0 0); --sidebar-ring: oklch(0.708 0 0); + + --accent-primary: #1e5eff; + --accent-hover: #174ad6; } .dark { @@ -111,15 +102,34 @@ --sidebar-accent-foreground: oklch(0.985 0 0); --sidebar-border: oklch(1 0 0 / 10%); --sidebar-ring: oklch(0.556 0 0); + + --accent-primary: #ff2d55; + --accent-hover: #e0264b; } @layer base { * { @apply border-border outline-ring/50; } + body { @apply bg-background text-foreground; } + + button, + [role='button'], + a { + cursor: pointer; + } +} + +@layer components { + .btn { + background-color: var(--accent-primary); + } + .btn:hover { + background-color: var(--accent-hover); + } } .no-select { diff --git a/frontend/components/quiz/QuizCard.tsx b/frontend/components/quiz/QuizCard.tsx index 882e2bad..d30a8291 100644 --- a/frontend/components/quiz/QuizCard.tsx +++ b/frontend/components/quiz/QuizCard.tsx @@ -24,27 +24,28 @@ interface QuizCardProps { export function QuizCard({ quiz, userProgress }: QuizCardProps) { const t = useTranslations('quiz.card'); - const percentage = userProgress && userProgress.totalQuestions > 0 - ? Math.round((userProgress.bestScore / userProgress.totalQuestions) * 100) - : 0; + const percentage = + userProgress && userProgress.totalQuestions > 0 + ? Math.round((userProgress.bestScore / userProgress.totalQuestions) * 100) + : 0; return (
-
- {quiz.categoryName ?? t('uncategorized')} - {userProgress && ( - {t('completed')} +
+ + {quiz.categoryName ?? t('uncategorized')} + + {userProgress && {t('completed')}} +
+

+ {quiz.title ?? quiz.slug} +

+ {quiz.description && ( +

+ {quiz.description} +

)} -
-

- {quiz.title ?? quiz.slug} -

- {quiz.description && ( -

- {quiz.description} -

- )}
@@ -52,34 +53,38 @@ export function QuizCard({ quiz, userProgress }: QuizCardProps) { - {Math.floor((quiz.timeLimitSeconds ?? quiz.questionsCount * 30) / 60)} {t('min')} + {Math.floor( + (quiz.timeLimitSeconds ?? quiz.questionsCount * 30) / 60 + )}{' '} + {t('min')}
{userProgress && ( -
-
- - {t('best')} {userProgress.bestScore}/{userProgress.totalQuestions} - - - {userProgress.attemptsCount} {userProgress.attemptsCount === 1 ? t('attempt') : t('attempts')} - - - {percentage}% - -
-
-
-
-
- )} +
+
+ + {t('best')} {userProgress.bestScore}/{userProgress.totalQuestions} + + + {userProgress.attemptsCount}{' '} + {userProgress.attemptsCount === 1 ? t('attempt') : t('attempts')} + + + {percentage}% + +
+
+
+
+
+ )} {userProgress ? t('retake') : t('start')}