From 166e22bdf35b9751dc42f5cc6cb27a99b077df93 Mon Sep 17 00:00:00 2001
From: "Fred K. Schott" <fkschott@gmail.com>
Date: Thu, 15 Jul 2021 14:13:35 -0400
Subject: merge in docs site (#705)

---
 docs/src/components/MenuToggle.tsx | 44 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 docs/src/components/MenuToggle.tsx

(limited to 'docs/src/components/MenuToggle.tsx')

diff --git a/docs/src/components/MenuToggle.tsx b/docs/src/components/MenuToggle.tsx
new file mode 100644
index 000000000..605581077
--- /dev/null
+++ b/docs/src/components/MenuToggle.tsx
@@ -0,0 +1,44 @@
+import type { FunctionalComponent } from 'preact';
+import { h, Fragment } from 'preact';
+import { useState, useEffect } from 'preact/hooks';
+
+const MenuToggle: FunctionalComponent = () => {
+  const [sidebarShown, setSidebarShown] = useState(false);
+
+  useEffect(() => {
+    const body = document.getElementsByTagName('body')[0];
+    if (sidebarShown) {
+      body.classList.add('mobile-sidebar-toggle');
+    } else {
+      body.classList.remove('mobile-sidebar-toggle');
+    }
+  }, [sidebarShown]);
+
+  return (
+    <button
+      type="button"
+      aria-pressed={sidebarShown ? 'true' : 'false'}
+      id="menu-toggle"
+      onClick={() => setSidebarShown(!sidebarShown)}
+    >
+      <svg
+        xmlns="http://www.w3.org/2000/svg"
+        width="1em"
+        height="1em"
+        fill="none"
+        viewBox="0 0 24 24"
+        stroke="currentColor"
+      >
+        <path
+          stroke-linecap="round"
+          stroke-linejoin="round"
+          stroke-width="2"
+          d="M4 6h16M4 12h16M4 18h16"
+        />
+      </svg>
+      <span className="sr-only">Toggle sidebar</span>
+    </button>
+  );
+};
+
+export default MenuToggle;
-- 
cgit v1.2.3

