-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
6a6716b
commit 45fe21c
Showing
11 changed files
with
153 additions
and
136 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,19 +1,24 @@ | ||
import { useState } from "react"; | ||
import style from "./style.module.css"; | ||
|
||
function HamburgerButton({children}) | ||
{ | ||
const [opened, setOpened] = useState(false); | ||
return <> | ||
<button className="flex md:hidden justify-center items-center size-6 z-10" aria-label="open-menu" onClick={ ()=>setOpened((state)=>!state) }> | ||
<div className={style.hamburger} data-opened={opened} > | ||
<div></div> | ||
</div> | ||
</button> | ||
<div className="fixed -z-10 w-full top-0 left-0 bg-white flex md:hidden flex-col justify-center items-center gap-2"> | ||
<div className="w-full mt-16 shadow-xl">{opened && children}</div> | ||
</div> | ||
</> | ||
function HamburgerButton({ children }) { | ||
const [opened, setOpened] = useState(false); | ||
return ( | ||
<> | ||
<button | ||
className="flex md:hidden justify-center items-center size-6 z-10" | ||
aria-label="open-menu" | ||
onClick={() => setOpened((state) => !state)} | ||
> | ||
<div className={style.hamburger} data-opened={opened}> | ||
<div></div> | ||
</div> | ||
</button> | ||
<div className="fixed -z-10 w-full top-0 left-0 bg-white flex md:hidden flex-col justify-center items-center gap-2"> | ||
<div className="w-full mt-16 shadow-xl">{opened && children}</div> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default HamburgerButton; | ||
export default HamburgerButton; |
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,52 +1,53 @@ | ||
.hamburger { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
position: relative; | ||
width: 24px; | ||
height: 20px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
position: relative; | ||
width: 24px; | ||
height: 20px; | ||
} | ||
|
||
.hamburger > div, .hamburger > div::before, .hamburger > div::after{ | ||
width: 100%; | ||
height: 2px; | ||
box-sizing: border-box; | ||
background-color: currentColor; | ||
transition: all 0.3s; | ||
.hamburger > div, | ||
.hamburger > div::before, | ||
.hamburger > div::after { | ||
width: 100%; | ||
height: 2px; | ||
box-sizing: border-box; | ||
background-color: currentColor; | ||
transition: all 0.3s; | ||
} | ||
|
||
.hamburger > div{ | ||
position: absolute; | ||
border-color: #24adaf; | ||
.hamburger > div { | ||
position: absolute; | ||
border-color: #24adaf; | ||
} | ||
|
||
.hamburger > div::before | ||
{ | ||
content: ""; | ||
display: block; | ||
position: absolute; | ||
top:0; | ||
left:0; | ||
transform: translateY(-10px); | ||
.hamburger > div::before { | ||
content: ""; | ||
display: block; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
transform: translateY(-10px); | ||
} | ||
|
||
.hamburger > div::after{ | ||
content: ""; | ||
display: block; | ||
position: absolute; | ||
top:0; | ||
left:0; | ||
transform: translateY(10px); | ||
.hamburger > div::after { | ||
content: ""; | ||
display: block; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
transform: translateY(10px); | ||
} | ||
|
||
.hamburger[data-opened="true"] > div { | ||
transform: rotate(135deg); | ||
transform: rotate(135deg); | ||
} | ||
|
||
.hamburger[data-opened="true"] > div::before { | ||
transform: translateY(0px) rotate(180deg); | ||
transform: translateY(0px) rotate(180deg); | ||
} | ||
|
||
.hamburger[data-opened="true"] > div::after { | ||
transform: translateY(-0px) rotate(-270deg); | ||
} | ||
transform: translateY(-0px) rotate(-270deg); | ||
} |
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
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
Oops, something went wrong.