-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
33 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import React from 'react'; | ||
|
||
const Buttons = () => { | ||
return <button>Click</button>; | ||
}; | ||
|
||
export default Buttons; | ||
export default function Buttons() { | ||
return <button type="button">Click</button>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
// pages/index.tsx | ||
import { useTheme } from "next-themes"; | ||
|
||
import { useTheme } from 'next-themes'; | ||
|
||
export default function IndexPage() { | ||
const { theme, setTheme } = useTheme(); | ||
const toggleTheme = () => | ||
setTheme(theme === "light" ? "dark" : "light"); | ||
const toggleTheme = () => setTheme(theme === 'light' ? 'dark' : 'light'); | ||
|
||
return ( | ||
<div> | ||
<h1>The current theme is {theme === "dark" ? "dark" : "light"}</h1> | ||
<button onClick={toggleTheme}>Change Theme</button> | ||
<h1>The current theme is {theme === 'dark' ? 'dark' : 'light'}</h1> | ||
<button type="button" onClick={toggleTheme}> | ||
Change Theme | ||
</button> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import type { AppProps } from "next/app"; | ||
import type { AppProps } from 'next/app'; | ||
import { ThemeProvider } from 'next-themes'; | ||
|
||
function MyApp({ Component, pageProps }) { | ||
export default function MyApp({ Component, pageProps }) { | ||
return ( | ||
<ThemeProvider defaultTheme="system" enableSystem={true} attribute="class"> | ||
<Component {...pageProps} />; | ||
</ThemeProvider> | ||
); | ||
} | ||
|
||
export default MyApp; |