mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 11:31:12 -05:00
Move to Phase 4-5
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, { createContext, useContext, useEffect, useState } from "react"
|
||||
import * as storage from "@/lib/localStorage"
|
||||
|
||||
type Theme = "dark" | "light" | "system"
|
||||
|
||||
@@ -27,7 +28,7 @@ export function ThemeProvider({
|
||||
...props
|
||||
}: ThemeProviderProps) {
|
||||
const [theme, setTheme] = useState<Theme>(
|
||||
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme
|
||||
() => (storage.getItem(storageKey) as Theme) || defaultTheme
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
@@ -51,7 +52,7 @@ export function ThemeProvider({
|
||||
const value = {
|
||||
theme,
|
||||
setTheme: (theme: Theme) => {
|
||||
localStorage.setItem(storageKey, theme)
|
||||
storage.setItem(storageKey, theme)
|
||||
setTheme(theme)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user