Spaces:
Paused
Paused
Download examples/with-script-in-browser/components/sidebar/ExampleSidebar.tsx from Leon4gr45/excalidraw: direct link, hf CLI and curl.
- Browser
- Download file 799 Bytes
-
https://huggingface.co/spaces/Leon4gr45/excalidraw/resolve/main/examples/with-script-in-browser/components/sidebar/ExampleSidebar.tsx
- Command line
-
hf download hf://spaces/Leon4gr45/excalidraw/examples/with-script-in-browser/components/sidebar/ExampleSidebar.tsx
-
curl -L -o ExampleSidebar.tsx https://huggingface.co/spaces/Leon4gr45/excalidraw/resolve/main/examples/with-script-in-browser/components/sidebar/ExampleSidebar.tsx
799 Bytes
| 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> | |
| </> | |
| ); | |
| } | |