update accessibility panel
This commit is contained in:
1 parent
85c0d8c4ab
commit
e0a6ddcafc
12 files changed
+174
-493
No files matched your search
@@ -1,5 +0,0 @@
|
||||
import { createContext } from "react"
|
||||
import { DEFAULT } from "./const"
|
||||
import { SetTheme, ThemeOptions } from "./types"
|
||||
|
||||
export const ThemeContext = createContext<[ThemeOptions, SetTheme]>([DEFAULT, () => {}])
|
||||
@@ -1,5 +0,0 @@
|
||||
import { ThemeOptions } from "./types"
|
||||
|
||||
export const DEFAULT: ThemeOptions = {
|
||||
theme: "default",
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export type ThemeOptions = {
|
||||
theme: "default" | "contrast"
|
||||
fontSize?: number
|
||||
}
|
||||
export type SetTheme = (theme: ThemeOptions["theme"]) => void
|
||||
@@ -1,18 +0,0 @@
|
||||
import { useContext } from "react"
|
||||
import { ThemeContext } from "./ThemeContext"
|
||||
import { SetTheme, ThemeOptions } from "./types"
|
||||
|
||||
export type UseThemeResult = {
|
||||
theme: ThemeOptions["theme"]
|
||||
setTheme: SetTheme
|
||||
// toggleTheme:
|
||||
}
|
||||
|
||||
export function useTheme(): UseThemeResult {
|
||||
const [theme, setTheme] = useContext(ThemeContext)
|
||||
|
||||
return {
|
||||
setTheme,
|
||||
theme: theme.theme ?? "default",
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user