Set colorscheme.
This commit is contained in:
parent
6ef9843835
commit
420a904efe
13 changed files with 94 additions and 1090 deletions
|
|
@ -10,7 +10,7 @@ import { ThemeProvider } from '@mui/material/styles'
|
|||
import { CssBaseline } from '@mui/material'
|
||||
|
||||
import type { Route } from './+types/root'
|
||||
import { theme, darkTheme } from './theme'
|
||||
import { theme } from './theme'
|
||||
import AppLayout from './components/Layout'
|
||||
import './app.css'
|
||||
|
||||
|
|
@ -46,14 +46,8 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|||
}
|
||||
|
||||
export default function App() {
|
||||
const isDarkMode =
|
||||
typeof window !== 'undefined' &&
|
||||
(localStorage.getItem('theme') === 'dark' ||
|
||||
(!localStorage.getItem('theme') &&
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches))
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={isDarkMode ? darkTheme : theme}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
<AppLayout>
|
||||
<Outlet />
|
||||
|
|
@ -78,14 +72,8 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|||
stack = error.stack
|
||||
}
|
||||
|
||||
const isDarkMode =
|
||||
typeof window !== 'undefined' &&
|
||||
(localStorage.getItem('theme') === 'dark' ||
|
||||
(!localStorage.getItem('theme') &&
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches))
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={isDarkMode ? darkTheme : theme}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
<AppLayout>
|
||||
<main className="pt-16 p-4 container mx-auto">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue