Skip to content

Commit

Permalink
Merge pull request #26 from p12-sandbox/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
yukyu30 authored Oct 19, 2021
2 parents d7746de + 10da317 commit fb7e4be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/components/ThemeChanger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { useState, useEffect } from "react";

export const ThemeChanger = () => {
const [mounted, setMounted] = useState(false)
const { theme, setTheme } = useTheme()


// When mounted on client, now we can show the UI
useEffect(() => setMounted(true), [])

if (!mounted) return null

if (!mounted) {
return null
}
const { theme, setTheme } = useTheme()
 if(theme === 'dark'){
return (
<button className="theme-changer_button" onClick={() => setTheme('light')}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "@src/styles/globals.scss";

export default function MyApp({ Component, pageProps }: AppProps) {
return (
<ThemeProvider>
<ThemeProvider defaultTheme="light">
<Head>
<link
rel="icon shortcut"
Expand Down

1 comment on commit fb7e4be

@vercel
Copy link

@vercel vercel bot commented on fb7e4be Oct 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.