Skip to content

Commit

Permalink
🌝 Another dark mode check
Browse files Browse the repository at this point in the history
  • Loading branch information
r-jo committed Jun 3, 2021
1 parent 944da23 commit f295148
Showing 1 changed file with 37 additions and 36 deletions.
73 changes: 37 additions & 36 deletions pages/user/[userId]/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function UserPage({ user }) {
<title>Auto Exposure | {firstname}</title>
</Head>
<section className="mx-auto w-full max-w-screen-2xl">
<div className="flex md:flex-row flex-col items-center md:space-x-6">
<div className="flex md:flex-row flex-col md:items-center md:space-x-6">
<img
src={profilePicture || defaultProfilePicture(_id)}
alt={firstname}
Expand Down Expand Up @@ -66,43 +66,44 @@ export default function UserPage({ user }) {
</button>
</Link>
)}

<button
aria-label="Toggle Dark Mode"
type="button"
className="hover:shadow-lg p-2
{isCurrentUser && (
<button
aria-label="Toggle Dark Mode"
type="button"
className="hover:shadow-lg p-2
transition duration-200 ease-in-out rounded-sm text-black dark:text-white font-medium
bg-gray-200 hover:bg-gray-300 dark:bg-gray-900 dark:hover:bg-gray-800"
onClick={() =>
setTheme(resolvedTheme === "dark" ? "light" : "dark")
}
>
{mounted && (
<>
{resolvedTheme === "dark" ? (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
className="h-5 w-5"
>
<SunIcon />
</svg>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
className="h-5 w-5"
>
<MoonIcon />
</svg>
)}
</>
)}
</button>
onClick={() =>
setTheme(resolvedTheme === "dark" ? "light" : "dark")
}
>
{mounted && (
<>
{resolvedTheme === "dark" ? (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
className="h-5 w-5"
>
<SunIcon />
</svg>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
className="h-5 w-5"
>
<MoonIcon />
</svg>
)}
</>
)}
</button>
)}
</div>
</div>
</div>
Expand Down

1 comment on commit f295148

@vercel
Copy link

@vercel vercel bot commented on f295148 Jun 3, 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.