add prettier config and format files site files

This commit is contained in:
Henry Dollman
2024-10-30 11:03:09 -04:00
parent 8827996553
commit 3505b215a2
75 changed files with 3096 additions and 3533 deletions

View File

@@ -1,6 +1,6 @@
import { createContext, useContext, useEffect, useState } from 'react'
import { createContext, useContext, useEffect, useState } from "react"
type Theme = 'dark' | 'light' | 'system'
type Theme = "dark" | "light" | "system"
type ThemeProviderProps = {
children: React.ReactNode
@@ -14,7 +14,7 @@ type ThemeProviderState = {
}
const initialState: ThemeProviderState = {
theme: 'system',
theme: "system",
setTheme: () => null,
}
@@ -22,23 +22,19 @@ const ThemeProviderContext = createContext<ThemeProviderState>(initialState)
export function ThemeProvider({
children,
defaultTheme = 'system',
storageKey = 'ui-theme',
defaultTheme = "system",
storageKey = "ui-theme",
...props
}: ThemeProviderProps) {
const [theme, setTheme] = useState<Theme>(
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme
)
const [theme, setTheme] = useState<Theme>(() => (localStorage.getItem(storageKey) as Theme) || defaultTheme)
useEffect(() => {
const root = window.document.documentElement
root.classList.remove('light', 'dark')
root.classList.remove("light", "dark")
if (theme === 'system') {
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light'
if (theme === "system") {
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
root.classList.add(systemTheme)
return