You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
799 B
32 lines
799 B
import React, { useState } from "react"; |
|
|
|
import "./ExampleSidebar.scss"; |
|
|
|
export default function Sidebar({ children }: { children: React.ReactNode }) { |
|
const [open, setOpen] = useState(false); |
|
|
|
return ( |
|
<> |
|
<div id="mySidebar" className={`sidebar ${open ? "open" : ""}`}> |
|
<button className="closebtn" onClick={() => setOpen(false)}> |
|
x |
|
</button> |
|
<div className="sidebar-links"> |
|
<button>Empty Home</button> |
|
<button>Empty About</button> |
|
</div> |
|
</div> |
|
<div className={`${open ? "sidebar-open" : ""}`}> |
|
<button |
|
className="openbtn" |
|
onClick={() => { |
|
setOpen(!open); |
|
}} |
|
> |
|
Open Sidebar |
|
</button> |
|
{children} |
|
</div> |
|
</> |
|
); |
|
}
|
|
|