fix theming
This commit is contained in:
parent
8eac71764a
commit
13426f34eb
3
src/app/globals.css
Normal file
3
src/app/globals.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
|
@ -1,6 +1,7 @@
|
|||
import type { Metadata } from 'next';
|
||||
import { Inter } from 'next/font/google';
|
||||
import ThemeWrapper from '@/lib/components/ThemeWrapper';
|
||||
import './globals.css';
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] });
|
||||
|
||||
|
@ -16,7 +17,7 @@ export default function RootLayout({
|
|||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>
|
||||
<body className={`${inter.className} p-4`}>
|
||||
<ThemeWrapper>
|
||||
{children}
|
||||
</ThemeWrapper>
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
"use client";
|
||||
|
||||
import { Button, Flex, Text } from '@radix-ui/themes';
|
||||
import { Heading } from '@radix-ui/themes';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<Flex direction="column" gap="2">
|
||||
<Text>Testicle obliteration dashboard</Text>
|
||||
<Button onClick={() => alert("The bottom surgery was a success")}>Obliterate testicles</Button>
|
||||
</Flex>
|
||||
<>
|
||||
<Heading size="9">Welcome back.</Heading>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,10 +9,12 @@ export default function ThemeWrapper({
|
|||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const [dark, setDark] = useState(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
const [dark, setDark] = useState(true);
|
||||
|
||||
// Automatically respond to theme changes
|
||||
useEffect(() => {
|
||||
setDark(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
|
||||
const onThemeChange = (event: MediaQueryListEvent) => {
|
||||
setDark(event.matches);
|
||||
};
|
||||
|
@ -21,11 +23,11 @@ export default function ThemeWrapper({
|
|||
match.addEventListener('change', onThemeChange);
|
||||
|
||||
return () => match.removeEventListener('change', onThemeChange);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return <Theme
|
||||
accentColor='ruby'
|
||||
grayColor='mauve'
|
||||
grayColor='slate'
|
||||
radius='large'
|
||||
scaling='95%'
|
||||
appearance={dark ? 'dark' : 'light'}
|
||||
|
|
Loading…
Reference in a new issue