1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-10-11 17:06:21 +02:00

build(deps): update latest

This commit is contained in:
2025-10-11 16:59:42 +02:00
parent 9c20844d89
commit be738a1c8d
29 changed files with 1456 additions and 1536 deletions

View File

@@ -1,7 +1,8 @@
import typescriptESLint from "typescript-eslint"
import { defineConfig } from "eslint/config"
import config from "@repo/config-eslint"
export default typescriptESLint.config(...config, {
export default defineConfig(...config, {
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: typescriptESLint.parser,

View File

@@ -30,7 +30,6 @@
"@repo/config-tailwind": "workspace:*",
"@repo/utils": "workspace:*",
"@repo/i18n": "workspace:*",
"@repo/react-hooks": "workspace:*",
"cva": "catalog:",
"next": "catalog:",
"next-intl": "catalog:",

View File

@@ -6,9 +6,9 @@ import { LOCALES } from "@repo/utils/constants"
import { useLocale } from "next-intl"
import { useEffect, useRef } from "react"
import { useBoolean } from "@repo/react-hooks/useBoolean"
import { Arrow } from "./Arrow.tsx"
import { LocaleFlag } from "./LocaleFlag.tsx"
import { useBoolean } from "../../../hooks/useBoolean.ts"
export interface LocalesProps {}

View File

@@ -1,13 +1,13 @@
"use client"
import { classNames } from "@repo/config-tailwind/classNames"
import { useIsMounted } from "@repo/react-hooks/useIsMounted"
import type { Theme } from "@repo/utils/constants"
import { THEME_DEFAULT } from "@repo/utils/constants"
import {
ThemeProvider as NextThemeProvider,
useTheme as useNextTheme,
} from "next-themes"
import { useEffect, useState } from "react"
export interface ThemeProviderProps extends React.PropsWithChildren {
forcedTheme?: Theme
@@ -35,7 +35,12 @@ export interface UseThemeOutput {
export const useTheme = (): UseThemeOutput => {
const { setTheme, theme: themeData } = useNextTheme()
const { isMounted } = useIsMounted()
const [isMounted, setIsMounted] = useState(false)
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setIsMounted(true)
}, [])
const theme = isMounted ? (themeData as Theme) : THEME_DEFAULT

View File

@@ -0,0 +1,50 @@
import { useState } from "react"
export interface UseBooleanOutput {
value: boolean
setValue: React.Dispatch<React.SetStateAction<boolean>>
setTrue: () => void
setFalse: () => void
toggle: () => void
}
export interface UseBooleanInput {
/**
* The initial value of the boolean.
* @default false
*/
initialValue?: boolean
}
/**
* Hook to manage a boolean state.
* @param input
* @returns
*/
export const useBoolean = (input: UseBooleanInput = {}): UseBooleanOutput => {
const { initialValue = false } = input
const [value, setValue] = useState(initialValue)
const toggle = (): void => {
setValue((old) => {
return !old
})
}
const setTrue = (): void => {
setValue(true)
}
const setFalse = (): void => {
setValue(false)
}
return {
value,
setValue,
toggle,
setTrue,
setFalse,
}
}