Skip to content

Commit a64f030

Browse files
committed
Added all themes to let user choose.
"theme-neutral" | "theme-rose" | "theme-green" | "theme-default" | "theme-blue" | "theme-orange" | "theme-red" | "theme-violet" | "theme-yellow"
1 parent 04020a9 commit a64f030

3 files changed

Lines changed: 508 additions & 6 deletions

File tree

‎frontend/src/components/ui/button.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority"
55
import { cn } from "@/lib/utils"
66

77
const buttonVariants = cva(
8-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
8+
"cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
99
{
1010
variants: {
1111
variant: {

‎frontend/src/hook/use-color-theme.hook.ts‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
import { useEffect, useState } from "react"
2-
import { useLocalStorage } from "@/hook/use-localstroage.hook"
2+
import { useLocalStorage } from "@/hook/use-localstroage.hook"
33

4-
export type ColorTheme = "theme-neutral" | "theme-rose"
4+
export type ColorTheme = "theme-neutral"
5+
| "theme-rose"
6+
| "theme-green"
7+
| "theme-default"
8+
| "theme-blue"
9+
| "theme-orange"
10+
| "theme-red"
11+
| "theme-violet"
12+
| "theme-yellow"
513

6-
export const colorThemes: ColorTheme[] = ["theme-neutral", "theme-rose"]
14+
export const colorThemes: ColorTheme[] = [
15+
"theme-neutral",
16+
"theme-rose",
17+
"theme-green",
18+
"theme-default",
19+
"theme-blue",
20+
"theme-orange",
21+
"theme-red",
22+
"theme-violet",
23+
"theme-yellow",
24+
]
725

826
export const useColorTheme = () => {
9-
const [ stroredColorTheme, setStroredColorTheme ]= useLocalStorage( "app_theme", "theme-rose")
10-
const [colorTheme, setColorTheme] = useState<ColorTheme>(stroredColorTheme as ColorTheme)
27+
const [stroredColorTheme, setStroredColorTheme] = useLocalStorage("app_theme", "theme-rose")
28+
const [colorTheme, setColorTheme] = useState<ColorTheme>(stroredColorTheme as ColorTheme)
1129

1230
useEffect(() => {
1331
let root = document.documentElement

0 commit comments

Comments
 (0)