MCPcopy Create free account
hub / github.com/api-platform/website / Sidebar

Function Sidebar

pwa/components/docs/Sidebar.tsx:6–52  ·  view source on GitHub ↗
({
  docMenuParts,
}: {
  docMenuParts: NavPartProps[];
})

Source from the content-addressed store, hash-verified

4import DocMenu, { NavPartProps } from "./DocMenu";
5
6export default function Sidebar({
7 docMenuParts,
8}: {
9 docMenuParts: NavPartProps[];
10}) {
11 const [minimized, setMinimized] = useState(false);
12 return (
13 <div
14 className={classNames(
15 "hidden w-72 z-20 sticky border-r border-r-gray-300 dark:border-r-blue-dark text-sm top-16 h-[calc(100vh-64px)] transition-all duration-300 | md:block",
16 minimized ? "w-px" : "w-72"
17 )}
18 >
19 <button
20 onClick={() => setMinimized(!minimized)}
21 className={classNames(
22 "w-6 h-8 shadow-md flex items-center justify-center absolute right-0 border-gray-100 top-2 z-50 rounded-l-md border-px border-r-0 transition-all duration-300",
23 minimized
24 ? "translate-x-full -scale-x-100 bg-blue dark:border-blue-dark text-white dark:text-blue-black"
25 : "bg-white dark:bg-blue-black text-blue dark:border-blue"
26 )}
27 >
28 <svg
29 xmlns="http://www.w3.org/2000/svg"
30 fill="none"
31 viewBox="0 0 24 24"
32 strokeWidth="1.5"
33 className="w-5 h-5 stroke-current"
34 >
35 <path
36 strokeLinecap="round"
37 strokeLinejoin="round"
38 d="M18.75 19.5l-7.5-7.5 7.5-7.5m-6 15L5.25 12l7.5-7.5"
39 />
40 </svg>
41 </button>
42 <nav
43 className={classNames(
44 "relative w-72 h-full px-8 pt-16 overflow-y-auto transition-all duration-300",
45 minimized && "-translate-x-full"
46 )}
47 >
48 {<DocMenu parts={docMenuParts} autoOpen />}
49 </nav>
50 </div>
51 );
52}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected