diff --git a/pages/index.tsx b/pages/index.tsx index c00deca..afa6d1b 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,10 +1,15 @@ +import ThemeSelector from '@/src/components/themeSelector'; import type { NextPage } from 'next'; const Home: NextPage = () => { return (
- +
); diff --git a/src/components/test/index.tsx b/src/components/test/index.tsx new file mode 100644 index 0000000..bc65ca6 --- /dev/null +++ b/src/components/test/index.tsx @@ -0,0 +1,3 @@ +export default function Test() { + return
Test
; +} diff --git a/src/components/ThemeToggle/index.tsx b/src/components/themeSelector/index.tsx similarity index 97% rename from src/components/ThemeToggle/index.tsx rename to src/components/themeSelector/index.tsx index c4d4d2e..27aded0 100644 --- a/src/components/ThemeToggle/index.tsx +++ b/src/components/themeSelector/index.tsx @@ -8,8 +8,9 @@ interface Props { className?: string; } -const ThemeToggle: React.FC = ({ className, ...props }) => { +const ThemeSelector: React.FC = ({ className, ...props }) => { const [selectedTheme, setSelectedTheme] = useState(); + useEffect(() => { if (selectedTheme) { document.documentElement.setAttribute('data-theme', selectedTheme.value); @@ -54,6 +55,7 @@ const ThemeToggle: React.FC = ({ className, ...props }) => { + {themes.map(theme => ( = ({ className, ...props }) => { ); }; -export default ThemeToggle; +export default ThemeSelector;