@@ -19,10 +19,13 @@ import {
1919 SelectTrigger ,
2020} from "@/components/ui/select"
2121import { useState } from "react" ;
22- import { themeModes , useTheme , type ThemeMode } from '@/hook/use-dark-or-light-theme.hook'
22+ import { themeModes , type ThemeMode } from '@/hook/use-dark-or-light-theme.hook'
2323import { ArrowLeftIcon , CircleArrowDown , CircleCheckBig , Copy , Images , LoaderCircle , Save , Share , Settings } from "lucide-react" ;
24- import { colorThemes , useColorTheme , type ColorTheme } from "@/hook/use-color-theme.hook" ;
25- import { showInfo , useShowCardInfo , type ShowInfo } from "@/hook/use-show-card-info.hook" ;
24+ import { colorThemes , type ColorTheme } from "@/hook/use-color-theme.hook" ;
25+ import { useColorThemeStore } from "@/store/use-color-theme.store" ;
26+ import { useThemeStore } from "@/store/use-theme.store" ;
27+ import { useFontStore , fonts } from "@/store/use-font.store" ;
28+ import { showInfo , useShowCardInfo , type ShowInfo } from "@/store/use-card-info.store" ;
2629import { capitalize } from "@/helper/capitalize" ;
2730
2831interface SortOptions { key : SortOption , label : string }
@@ -42,10 +45,11 @@ interface Props {
4245}
4346
4447export function SettingComponent ( props : Props ) {
45- const { theme, setTheme } = useTheme ( )
46- const [ open , setOpen ] = useState ( false )
47- const { colorTheme, setColorTheme } = useColorTheme ( )
48+ const { theme, setTheme, isDark } = useThemeStore ( )
49+ const [ open , setOpen ] = useState ( false )
50+ const { colorTheme, setColorTheme } = useColorThemeStore ( )
4851 const { info, setInfo } = useShowCardInfo ( )
52+ const { font, setFont } = useFontStore ( )
4953
5054 const [ sortBy , setSortBy ] = useState < SortOptions [ "key" ] > ( "created_at" )
5155
@@ -116,18 +120,20 @@ export function SettingComponent(props: Props) {
116120 </ Select >
117121 </ div >
118122 < div className = "flex justify-between items-center " >
119- Sort by
120- < Select value = { sortBy } onValueChange = { ( value ) => setSortBy ( value as SortOption ) } >
123+ Font
124+ < Select value = { font } onValueChange = { ( value ) => setFont ( value ) } >
121125 < SelectTrigger className = "" >
122- < SelectValue placeholder = "Sort By " />
126+ < SelectValue placeholder = "Font " />
123127 </ SelectTrigger >
124128 < SelectContent >
125129 {
126- sortOptions . map ( ( pri ) => {
127- let yo = capitalize ( pri . key )
130+ fonts . map ( ( pri ) => {
131+ let yoyoyo = pri . replace ( "font-" , "" )
132+ let yoyo = yoyoyo . replaceAll ( "-" , " " )
133+ let yo = capitalize ( yoyo )
128134 return (
129- < SelectItem key = { pri . key } value = { pri . key } className = "" >
130- { yo . replaceAll ( '_' , " " ) }
135+ < SelectItem key = { pri } value = { pri } className = "" >
136+ { yo }
131137 </ SelectItem >
132138 )
133139 } )
@@ -161,6 +167,27 @@ export function SettingComponent(props: Props) {
161167 </ SelectContent >
162168 </ Select >
163169 </ div >
170+ < div className = "flex justify-between items-center " >
171+ Sort by
172+ < Select value = { sortBy } onValueChange = { ( value ) => setSortBy ( value as SortOption ) } >
173+ < SelectTrigger className = "" >
174+ < SelectValue placeholder = "Sort By" />
175+ </ SelectTrigger >
176+ < SelectContent >
177+ {
178+ sortOptions . map ( ( pri ) => {
179+ let yo = capitalize ( pri . key )
180+ return (
181+ < SelectItem key = { pri . key } value = { pri . key } className = "" >
182+ { yo . replaceAll ( '_' , " " ) }
183+ </ SelectItem >
184+ )
185+ } )
186+ }
187+ </ SelectContent >
188+ </ Select >
189+ </ div >
190+
164191 </ div >
165192
166193 < Separator className = "bg-border" />
0 commit comments