1
1
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:
2023-08-01 14:11:46 +02:00
parent e82db952db
commit caa6a90418
21 changed files with 117 additions and 117 deletions

View File

@ -1,8 +1,11 @@
/** How long in milliseconds, until the cookie expires (10 years). */
export const COOKIE_MAX_AGE = 10 * 365.25 * 24 * 60 * 60 * 1000
export type CookiesStore = string | object | null | undefined
export const AVAILABLE_LOCALES = ['en-US', 'fr-FR'] as const
export const LOCALES = ['en-US', 'fr-FR'] as const
export type Locale = (typeof LOCALES)[number]
export const DEFAULT_LOCALE = 'en-US' satisfies Locale
export type AvailableLocale = (typeof AVAILABLE_LOCALES)[number]
export const DEFAULT_LOCALE = 'en-US' satisfies AvailableLocale
export const THEMES = ['light', 'dark'] as const
export type Theme = (typeof THEMES)[number]
export const DEFAULT_THEME = 'dark' satisfies Theme

View File

@ -8,9 +8,8 @@ export const BIRTH_DATE_ISO_8601 =
export const BIRTH_DATE = new Date(BIRTH_DATE_ISO_8601)
/**
* Calculates the age of a person based on their birth date
* Calculates the age of a person based on their birth date.
* @param birthDate
* @returns
*/
export const getAge = (birthDate: Date): number => {
const today = new Date()