Skip to content

Commit 34809b2

Browse files
committed
fixed bug in icon toggleTheme, nav separate header
1 parent de560f3 commit 34809b2

5 files changed

Lines changed: 95 additions & 78 deletions

File tree

src/components/header.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import Link from "next/link";
2+
import { useState } from "react";
3+
import Modal from "./modal";
4+
import NavBar from "./navbar";
5+
6+
export default function Header() {
7+
const [isOpenedModal, setIsOpenedModal] = useState(false);
8+
9+
return(
10+
<header className="h-auto w-full pt-4 flex justify-between items-center px-8 md:px-0 md:justify-around md:h-16 absolute top-0">
11+
<Link href="/">
12+
<div className="w-10 h-10 md:w-12 md:h-12 rounded-full ring-4 ring-violet-700/5 shadow-sm shadow-violet-700/10 bakcdrop-blur relative select-none">
13+
<img className="object-cove rounded-full" src="/images/My.png" alt="Althor image" />
14+
</div>
15+
</Link>
16+
17+
<NavBar
18+
isOpenedModal={isOpenedModal}
19+
setIsOpenedModal={setIsOpenedModal}
20+
/>
21+
22+
{isOpenedModal && <Modal />}
23+
</header>
24+
)
25+
}

src/components/layout.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import Head from "next/head"
22
import { useRouter } from 'next/router'
33
import Link from "next/link"
4-
import { ReactNode, useState } from "react"
5-
import NavBar from "./navbar"
4+
import { ReactNode } from "react"
5+
import Header from "./header"
66
import NextProgress from "next-progress"
77

8-
type PropsChildren = {
8+
interface PropsChildren {
99
children: ReactNode
1010
}
1111

1212
export default function Layout({ children }: PropsChildren) {
1313
const router = useRouter();
14-
const [checkRouter, setCheckRouter] = useState(router.pathname == "/");
14+
const checkRouter = (router.pathname == "/");
1515

1616
return (
1717
<div className="h-screen w-full font-pontserrat">
@@ -22,7 +22,7 @@ export default function Layout({ children }: PropsChildren) {
2222
</Head>
2323
<NextProgress color="rgb(139 92 246)" delay={500} />
2424

25-
<NavBar />
25+
<Header />
2626

2727
<main className="w-full h-full pt-16 sm:pt-24">
2828
<div className={`px-4 py-7 sm:p-y sm:pr-0 sm:w-4/5 h-full mx-auto overflow-y-auto relative ${checkRouter ? "" : "md:border-l-[2.8px] border-dashed border-black/25 dark:border-white/25"}`}>
@@ -31,31 +31,31 @@ export default function Layout({ children }: PropsChildren) {
3131
<ul className={`flex gap-3 md:gap-4 ${checkRouter ? "sm:flex-row" : "sm:flex-row lg:flex-col"} items-center`}>
3232
<li>
3333
<Link href="https://github.com/dc7devs" target="__blank">
34-
<svg viewBox="0 0 24 24" aria-hidden="true" className="h-7 w-7 fill-zinc-500 transition group-hover:fill-zinc-600 dark:fill-zinc-400 dark:group-hover:fill-zinc-300"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 2C6.475 2 2 6.588 2 12.253c0 4.537 2.862 8.369 6.838 9.727.5.09.687-.218.687-.487 0-.243-.013-1.05-.013-1.91C7 20.059 6.35 18.957 6.15 18.38c-.113-.295-.6-1.205-1.025-1.448-.35-.192-.85-.667-.013-.68.788-.012 1.35.744 1.538 1.051.9 1.551 2.338 1.116 2.912.846.088-.666.35-1.115.638-1.371-2.225-.256-4.55-1.14-4.55-5.062 0-1.115.387-2.038 1.025-2.756-.1-.256-.45-1.307.1-2.717 0 0 .837-.269 2.75 1.051.8-.23 1.65-.346 2.5-.346.85 0 1.7.115 2.5.346 1.912-1.333 2.75-1.05 2.75-1.05.55 1.409.2 2.46.1 2.716.637.718 1.025 1.628 1.025 2.756 0 3.934-2.337 4.806-4.562 5.062.362.32.675.936.675 1.897 0 1.371-.013 2.473-.013 2.82 0 .268.188.589.688.486a10.039 10.039 0 0 0 4.932-3.74A10.447 10.447 0 0 0 22 12.253C22 6.588 17.525 2 12 2Z"></path></svg>
34+
<svg viewBox="0 0 24 24" aria-hidden="true" className="h-7 w-7 fill-zinc-500 transition hover:fill-zinc-600 dark:fill-zinc-400 dark:hover:fill-zinc-300"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 2C6.475 2 2 6.588 2 12.253c0 4.537 2.862 8.369 6.838 9.727.5.09.687-.218.687-.487 0-.243-.013-1.05-.013-1.91C7 20.059 6.35 18.957 6.15 18.38c-.113-.295-.6-1.205-1.025-1.448-.35-.192-.85-.667-.013-.68.788-.012 1.35.744 1.538 1.051.9 1.551 2.338 1.116 2.912.846.088-.666.35-1.115.638-1.371-2.225-.256-4.55-1.14-4.55-5.062 0-1.115.387-2.038 1.025-2.756-.1-.256-.45-1.307.1-2.717 0 0 .837-.269 2.75 1.051.8-.23 1.65-.346 2.5-.346.85 0 1.7.115 2.5.346 1.912-1.333 2.75-1.05 2.75-1.05.55 1.409.2 2.46.1 2.716.637.718 1.025 1.628 1.025 2.756 0 3.934-2.337 4.806-4.562 5.062.362.32.675.936.675 1.897 0 1.371-.013 2.473-.013 2.82 0 .268.188.589.688.486a10.039 10.039 0 0 0 4.932-3.74A10.447 10.447 0 0 0 22 12.253C22 6.588 17.525 2 12 2Z"></path></svg>
3535
</Link>
3636
</li>
3737

3838
<li>
3939
<Link href="https://www.linkedin.com/in/diego-c-silva-487b171a5/" target="__blank">
40-
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024" height="1em" width="1em" className="h-6 w-6 fill-zinc-500 transition group-hover:fill-zinc-600 dark:fill-zinc-400 dark:group-hover:fill-zinc-300" xmlns="http://www.w3.org/2000/svg"><path d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM349.3 793.7H230.6V411.9h118.7v381.8zm-59.3-434a68.8 68.8 0 1 1 68.8-68.8c-.1 38-30.9 68.8-68.8 68.8zm503.7 434H675.1V608c0-44.3-.8-101.2-61.7-101.2-61.7 0-71.2 48.2-71.2 98v188.9H423.7V411.9h113.8v52.2h1.6c15.8-30 54.5-61.7 112.3-61.7 120.2 0 142.3 79.1 142.3 181.9v209.4z"></path></svg>
40+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024" height="1em" width="1em" className="h-6 w-6 fill-zinc-500 transition hover:fill-zinc-600 dark:fill-zinc-400 dark:hover:fill-zinc-300" xmlns="http://www.w3.org/2000/svg"><path d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM349.3 793.7H230.6V411.9h118.7v381.8zm-59.3-434a68.8 68.8 0 1 1 68.8-68.8c-.1 38-30.9 68.8-68.8 68.8zm503.7 434H675.1V608c0-44.3-.8-101.2-61.7-101.2-61.7 0-71.2 48.2-71.2 98v188.9H423.7V411.9h113.8v52.2h1.6c15.8-30 54.5-61.7 112.3-61.7 120.2 0 142.3 79.1 142.3 181.9v209.4z"></path></svg>
4141
</Link>
4242
</li>
4343

4444
<li>
4545
<Link href="https://www.youtube.com/channel/UCQCBtV_fonx-JZj-OnIFcSw" target="__blank">
46-
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024" height="1em" width="1em" className="h-6 w-6 fill-zinc-500 transition group-hover:fill-zinc-600 dark:fill-zinc-400 dark:group-hover:fill-zinc-300" xmlns="http://www.w3.org/2000/svg"><path d="M941.3 296.1a112.3 112.3 0 0 0-79.2-79.3C792.2 198 512 198 512 198s-280.2 0-350.1 18.7A112.12 112.12 0 0 0 82.7 296C64 366 64 512 64 512s0 146 18.7 215.9c10.3 38.6 40.7 69 79.2 79.3C231.8 826 512 826 512 826s280.2 0 350.1-18.8c38.6-10.3 68.9-40.7 79.2-79.3C960 658 960 512 960 512s0-146-18.7-215.9zM423 646V378l232 133-232 135z"></path></svg>
46+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024" height="1em" width="1em" className="h-6 w-6 fill-zinc-500 transition hover:fill-zinc-600 dark:fill-zinc-400 dark:hover:fill-zinc-300" xmlns="http://www.w3.org/2000/svg"><path d="M941.3 296.1a112.3 112.3 0 0 0-79.2-79.3C792.2 198 512 198 512 198s-280.2 0-350.1 18.7A112.12 112.12 0 0 0 82.7 296C64 366 64 512 64 512s0 146 18.7 215.9c10.3 38.6 40.7 69 79.2 79.3C231.8 826 512 826 512 826s280.2 0 350.1-18.8c38.6-10.3 68.9-40.7 79.2-79.3C960 658 960 512 960 512s0-146-18.7-215.9zM423 646V378l232 133-232 135z"></path></svg>
4747
</Link>
4848
</li>
4949

5050
<li>
5151
<Link href="https://discord.com/users/687863744541491294" target="__blank">
52-
<svg className="h-6 w-6 fill-zinc-500 transition group-hover:fill-zinc-600 dark:fill-zinc-400 dark:group-hover:fill-zinc-300" aria-hidden="true" focusable="false" data-prefix="fab" data-icon="discord" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M524.5 69.84a1.5 1.5 0 0 0 -.764-.7A485.1 485.1 0 0 0 404.1 32.03a1.816 1.816 0 0 0 -1.923 .91 337.5 337.5 0 0 0 -14.9 30.6 447.8 447.8 0 0 0 -134.4 0 309.5 309.5 0 0 0 -15.14-30.6 1.89 1.89 0 0 0 -1.924-.91A483.7 483.7 0 0 0 116.1 69.14a1.712 1.712 0 0 0 -.788 .676C39.07 183.7 18.19 294.7 28.43 404.4a2.016 2.016 0 0 0 .765 1.375A487.7 487.7 0 0 0 176 479.9a1.9 1.9 0 0 0 2.063-.676A348.2 348.2 0 0 0 208.1 430.4a1.86 1.86 0 0 0 -1.019-2.588 321.2 321.2 0 0 1 -45.87-21.85 1.885 1.885 0 0 1 -.185-3.126c3.082-2.309 6.166-4.711 9.109-7.137a1.819 1.819 0 0 1 1.9-.256c96.23 43.92 200.4 43.92 295.5 0a1.812 1.812 0 0 1 1.924 .233c2.944 2.426 6.027 4.851 9.132 7.16a1.884 1.884 0 0 1 -.162 3.126 301.4 301.4 0 0 1 -45.89 21.83 1.875 1.875 0 0 0 -1 2.611 391.1 391.1 0 0 0 30.01 48.81 1.864 1.864 0 0 0 2.063 .7A486 486 0 0 0 610.7 405.7a1.882 1.882 0 0 0 .765-1.352C623.7 277.6 590.9 167.5 524.5 69.84zM222.5 337.6c-28.97 0-52.84-26.59-52.84-59.24S193.1 219.1 222.5 219.1c29.67 0 53.31 26.82 52.84 59.24C275.3 310.1 251.9 337.6 222.5 337.6zm195.4 0c-28.97 0-52.84-26.59-52.84-59.24S388.4 219.1 417.9 219.1c29.67 0 53.31 26.82 52.84 59.24C470.7 310.1 447.5 337.6 417.9 337.6z"></path></svg>
52+
<svg className="h-6 w-6 fill-zinc-500 transition hover:fill-zinc-600 dark:fill-zinc-400 dark:hover:fill-zinc-300" aria-hidden="true" focusable="false" data-prefix="fab" data-icon="discord" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M524.5 69.84a1.5 1.5 0 0 0 -.764-.7A485.1 485.1 0 0 0 404.1 32.03a1.816 1.816 0 0 0 -1.923 .91 337.5 337.5 0 0 0 -14.9 30.6 447.8 447.8 0 0 0 -134.4 0 309.5 309.5 0 0 0 -15.14-30.6 1.89 1.89 0 0 0 -1.924-.91A483.7 483.7 0 0 0 116.1 69.14a1.712 1.712 0 0 0 -.788 .676C39.07 183.7 18.19 294.7 28.43 404.4a2.016 2.016 0 0 0 .765 1.375A487.7 487.7 0 0 0 176 479.9a1.9 1.9 0 0 0 2.063-.676A348.2 348.2 0 0 0 208.1 430.4a1.86 1.86 0 0 0 -1.019-2.588 321.2 321.2 0 0 1 -45.87-21.85 1.885 1.885 0 0 1 -.185-3.126c3.082-2.309 6.166-4.711 9.109-7.137a1.819 1.819 0 0 1 1.9-.256c96.23 43.92 200.4 43.92 295.5 0a1.812 1.812 0 0 1 1.924 .233c2.944 2.426 6.027 4.851 9.132 7.16a1.884 1.884 0 0 1 -.162 3.126 301.4 301.4 0 0 1 -45.89 21.83 1.875 1.875 0 0 0 -1 2.611 391.1 391.1 0 0 0 30.01 48.81 1.864 1.864 0 0 0 2.063 .7A486 486 0 0 0 610.7 405.7a1.882 1.882 0 0 0 .765-1.352C623.7 277.6 590.9 167.5 524.5 69.84zM222.5 337.6c-28.97 0-52.84-26.59-52.84-59.24S193.1 219.1 222.5 219.1c29.67 0 53.31 26.82 52.84 59.24C275.3 310.1 251.9 337.6 222.5 337.6zm195.4 0c-28.97 0-52.84-26.59-52.84-59.24S388.4 219.1 417.9 219.1c29.67 0 53.31 26.82 52.84 59.24C470.7 310.1 447.5 337.6 417.9 337.6z"></path></svg>
5353
</Link>
5454
</li>
5555

5656
<li>
5757
<Link href="mailto:diegocaetano444@outlook.com" target="__blank">
58-
<svg viewBox="0 0 24 24" aria-hidden="true" className="h-6 w-6 fill-zinc-500 transition group-hover:fill-zinc-600 dark:fill-zinc-400 dark:group-hover:fill-zinc-300"><path fill-rule="evenodd" d="M6 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h12a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H6Zm.245 2.187a.75.75 0 0 0-.99 1.126l6.25 5.5a.75.75 0 0 0 .99 0l6.25-5.5a.75.75 0 0 0-.99-1.126L12 12.251 6.245 7.187Z"></path></svg>
58+
<svg viewBox="0 0 24 24" aria-hidden="true" className="h-6 w-6 fill-zinc-500 transition hover:fill-zinc-600 dark:fill-zinc-400 dark:hover:fill-zinc-300"><path fill-rule="evenodd" d="M6 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h12a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H6Zm.245 2.187a.75.75 0 0 0-.99 1.126l6.25 5.5a.75.75 0 0 0 .99 0l6.25-5.5a.75.75 0 0 0-.99-1.126L12 12.251 6.245 7.187Z"></path></svg>
5959
</Link>
6060
</li>
6161
</ul>

src/components/navbar.tsx

Lines changed: 40 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,55 @@
11
import Link from "next/link";
22
import { useRouter } from "next/router";
33
import { CirclesFour, CirclesThreePlus, X } from "phosphor-react";
4-
import { useState } from "react";
5-
import Modal from "./modal";
4+
import { Dispatch, SetStateAction, useState } from "react";
65
import ToggleThemeBtn from "./toggle-dark-theme-btn";
76

8-
export default function NavBar() {
7+
type useEffectProps = {
8+
isOpenedModal: boolean
9+
setIsOpenedModal: Dispatch<SetStateAction<boolean>>
10+
}
11+
12+
export default function NavBar({ isOpenedModal, setIsOpenedModal }: useEffectProps) {
913
const router = useRouter();
10-
const [isOpenedModal, setIsOpenedModal] = useState(false);
1114
const [effect, setEffect] = useState(false);
1215

1316
function changeCurrentStateModal() {
1417
setIsOpenedModal(!isOpenedModal);
1518
}
1619

17-
return(
18-
<nav className="h-auto w-full pt-4 text-base flex justify-between items-center px-8 md:px-0 md:justify-around md:h-16 absolute top-0">
19-
<Link href="/">
20-
<div className="w-10 h-10 md:w-12 md:h-12 rounded-full ring-4 ring-violet-700/5 shadow-sm shadow-violet-700/10 bakcdrop-blur relative select-none">
21-
<img className="object-cove rounded-full" src="/images/My.png" alt="Althor image" />
22-
</div>
23-
</Link>
24-
25-
<div className="flex justify-center items-center">
26-
<ul className="hidden sm:flex justify-stretch items-cente gap-x-3">
27-
<li className={`${router.pathname == "/" ? "text-zinc-900/90 font-semibold" : "text-base" } font-medium sm:min-w-max sm:w-16 sm:flex sm:justify-center sm:hover:text-violet-900/80 sm:hover:medium hover:transition duration-75 ease-in-out md:text-lg md:w-20 select-none`}>
28-
<Link href="/">Home</Link>
29-
</li>
30-
<li className={`${router.pathname == "/about" ? "text-zinc-900/90 font-semibold" : "text-base"} font-medium sm:min-w-max sm:w-16 sm:flex sm:justify-center sm:hover:text-violet-900/80 sm:hover:medium hover:transition duration-75 ease-in-out md:text-lg md:w-20 select-none`}>
31-
<Link href="/about">About</Link>
32-
</li>
33-
<li className={`${router.pathname == "/projects" ? "text-zinc-900/90 font-semibold" : "text-base"} font-medium sm:min-w-max sm:w-16 sm:flex sm:justify-center sm:hover:text-violet-900/80 sm:hover:medium hover:transition duration-75 ease-in-out md:text-lg md:w-20 select-none`}>
34-
<Link href="/projects">Projects</Link>
35-
</li>
36-
<li className={`${router.pathname == "/contact" ? "text-zinc-900/90 font-semibold" : "text-base"} font-medium sm:min-w-max sm:w-16 sm:flex sm:justify-center sm:hover:text-violet-900/80 sm:hover:medium hover:transition duration-75 ease-in-out md:text-lg md:w-20 select-none`}>
37-
<Link href="/contact">Contact</Link>
38-
</li>
39-
</ul>
40-
41-
<hr className="hidden sm:block w-0.5 h-5 bg-separator/80 dark:bg-white/25 mx-5 md:mx-7 shadow-md rounded-full" />
42-
43-
<button
44-
className={`relative z-50 text-2xl hover:text-violet-900/80 dark:hover:text-violet-300/70 transition ${effect && "animate-effect"} duration-75 ease-in-out mr-3`}
45-
onClick={() => {
46-
setEffect(true);
47-
changeCurrentStateModal();
48-
}}
49-
onAnimationEnd={() => setEffect(false)}
50-
>
51-
{
52-
effect ? <CirclesFour size={25} /> : (isOpenedModal ? <X size={25} /> : <CirclesThreePlus size={25} />)
53-
}
54-
</button>
55-
56-
<ToggleThemeBtn />
57-
</div>
58-
59-
{isOpenedModal && <Modal />}
20+
return (
21+
<nav className="flex justify-center items-center">
22+
<ul className="hidden sm:flex justify-stretch items-cente gap-x-3">
23+
<li className={`${router.pathname == "/" && "text-zinc-900/90 dark:fill-zinc-400/90 font-semibold" } font-medium sm:min-w-max sm:w-16 sm:flex sm:justify-center hover:text-violet-900/80 hover:transition hover:duration-75 hover:ease-in-out md:text-lg md:w-20 select-none`}>
24+
<Link href="/">Home</Link>
25+
</li>
26+
<li className={`${router.pathname == "/about" && "text-zinc-900/90 dark:fill-zinc-400/90 font-semibold"} font-medium sm:min-w-max sm:w-16 sm:flex sm:justify-center hover:text-violet-900/80 hover:transition hover:duration-75 hover:ease-in-out md:text-lg md:w-20 select-none`}>
27+
<Link href="/about">About</Link>
28+
</li>
29+
<li className={`${router.pathname == "/projects" && "text-zinc-900/90 dark:fill-zinc-400/90 font-semibold"} font-medium sm:min-w-max sm:w-16 sm:flex sm:justify-center hover:text-violet-900/80 hover:transition hover:duration-75 hover:ease-in-out md:text-lg md:w-20 select-none`}>
30+
<Link href="/projects">Projects</Link>
31+
</li>
32+
<li className={`${router.pathname == "/contact" && "text-zinc-900/90 dark:fill-zinc-400/90 font-semibold"} font-medium sm:min-w-max sm:w-16 sm:flex sm:justify-center hover:text-violet-900/80 hover:transition hover:duration-75 hover:ease-in-out md:text-lg md:w-20 select-none`}>
33+
<Link href="/contact">Contact</Link>
34+
</li>
35+
</ul>
36+
37+
<hr className="hidden sm:block w-0.5 h-5 bg-separator/80 dark:bg-white/25 mx-5 md:mx-7 shadow-md rounded-full" />
38+
39+
<button
40+
className={`relative z-50 text-2xl hover:text-violet-900/80 dark:hover:text-violet-300/70 ${effect && "animate-effect"} mr-3`}
41+
onClick={() => {
42+
setEffect(true);
43+
changeCurrentStateModal();
44+
}}
45+
onAnimationEnd={() => setEffect(false)}
46+
>
47+
{
48+
effect ? <CirclesFour size={25} /> : (isOpenedModal ? <X size={25} /> : <CirclesThreePlus size={25} />)
49+
}
50+
</button>
51+
52+
<ToggleThemeBtn />
6053
</nav>
6154
)
6255
}
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
import { useTheme } from "next-themes";
2-
import { MoonStars, SunDim } from "phosphor-react";
3-
import { useEffect, useState } from "react";
2+
import { CircleDashed, MoonStars, SunDim } from "phosphor-react";
3+
import { useLayoutEffect, useState } from "react";
44

55
export default function ToggleThemeBtn() {
66
const [mounted, setMounted] = useState(false);
7-
const { theme, setTheme } = useTheme();
7+
const {theme, setTheme} = useTheme();
88
const [effect, setEffect] = useState(false);
99

10-
useEffect(() => {
11-
setMounted(true)
10+
useLayoutEffect(() => {
11+
setMounted(true);
1212
setEffect(true);
1313
}, [])
1414

15-
if(!mounted) return null;
16-
17-
function isDark() {
18-
return theme == "dark";
19-
}
15+
function isDark() {return theme == "dark"}
2016

2117
return (
22-
<button
23-
className={`text-2xl hover:text-violet-900/80 dark:hover:text-violet-300/70 ${effect && 'animate-effect-2'}`}
24-
onClick={() => {
25-
setTheme(isDark() ? "light" : "dark")
26-
}}
27-
onAnimationEnd={() => setEffect(false)}
28-
>
29-
{isDark() ? <MoonStars size={25} /> : <SunDim size={26} />}
30-
</button>
18+
<>{
19+
mounted ?
20+
<button
21+
className={`text-2xl hover:text-violet-900/80 dark:hover:text-violet-300/70 ${effect && 'animate-effect-2'}`}
22+
onClick={() => {
23+
setTheme(isDark() ? "light" : "dark")
24+
}}
25+
onAnimationEnd={() => setEffect(false)}
26+
>
27+
{isDark() ? <MoonStars size={25} /> : <SunDim size={26} />}
28+
</button>: <CircleDashed size={25} />
29+
}</>
3130
)
3231
}

0 commit comments

Comments
 (0)