mirror of
https://github.com/theoludwig/theoludwig.git
synced 2025-05-29 22:37:44 +02:00
refactor: implement light/dark themes using cookies
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import Image from 'next/image'
|
||||
|
||||
import type { CookiesStore } from '@/i18n/i18n.client'
|
||||
import type { CookiesStore } from '@/utils/constants'
|
||||
import { useI18n } from '@/i18n/i18n.client'
|
||||
|
||||
export interface LocaleFlagProps {
|
||||
|
@ -3,8 +3,8 @@
|
||||
import { useCallback, useEffect, useState, useRef } from 'react'
|
||||
import classNames from 'clsx'
|
||||
|
||||
import { AVAILABLE_LOCALES } from '@/utils/constants'
|
||||
import type { CookiesStore } from '@/i18n/i18n.client'
|
||||
import type { Locale as LocaleType, CookiesStore } from '@/utils/constants'
|
||||
import { LOCALES } from '@/utils/constants'
|
||||
|
||||
import { Arrow } from './Arrow'
|
||||
import { LocaleFlag } from './LocaleFlag'
|
||||
@ -43,7 +43,7 @@ export const Locales = (props: LocalesProps): JSX.Element => {
|
||||
}
|
||||
}, [])
|
||||
|
||||
const handleLocale = async (locale: string): Promise<void> => {
|
||||
const handleLocale = async (locale: LocaleType): Promise<void> => {
|
||||
const { setLocale } = await import('@/i18n/i18n.server')
|
||||
setLocale(locale)
|
||||
}
|
||||
@ -70,7 +70,7 @@ export const Locales = (props: LocalesProps): JSX.Element => {
|
||||
{ hidden: hiddenMenu }
|
||||
)}
|
||||
>
|
||||
{AVAILABLE_LOCALES.filter((locale) => {
|
||||
{LOCALES.filter((locale) => {
|
||||
return locale !== currentLocale
|
||||
}).map((locale) => {
|
||||
return (
|
||||
|
Reference in New Issue
Block a user