From 6bca7c83a7e2d62015f45f873b0f69f11b4d902b Mon Sep 17 00:00:00 2001
From: "Fred K. Schott" <fkschott@gmail.com>
Date: Tue, 8 Jun 2021 08:10:56 -0700
Subject: redesign create-astro (#301)

* redesign create astro

* add changeset

* Use npm start

* Update the astro version

* Adds the changeset

Co-authored-by: Fred Schott <fks@Freds-MBP.attlocal.net>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
---
 examples/doc/src/components/DocSidebar.tsx | 61 ------------------------------
 1 file changed, 61 deletions(-)
 delete mode 100644 examples/doc/src/components/DocSidebar.tsx

(limited to 'examples/doc/src/components/DocSidebar.tsx')

diff --git a/examples/doc/src/components/DocSidebar.tsx b/examples/doc/src/components/DocSidebar.tsx
deleted file mode 100644
index 076d460cc..000000000
--- a/examples/doc/src/components/DocSidebar.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import type { FunctionalComponent } from 'preact';
-import { h } from 'preact';
-import { useState, useEffect, useRef } from 'preact/hooks';
-import EditOnGithub from './EditOnGithub';
-
-const DocSidebar: FunctionalComponent<{ headers: any[]; editHref: string }> = ({ headers = [], editHref }) => {
-  const itemOffsets = useRef([]);
-  const [activeId, setActiveId] = useState<string>(undefined);
-
-  useEffect(() => {
-    const getItemOffsets = () => {
-      const titles = document.querySelectorAll('article :is(h2, h3, h4)');
-      itemOffsets.current = Array.from(titles).map((title) => ({
-        id: title.id,
-        topOffset: title.getBoundingClientRect().top + window.scrollY,
-      }));
-    };
-
-    const onScroll = () => {
-      const itemIndex = itemOffsets.current.findIndex((item) => item.topOffset > window.scrollY + window.innerHeight / 3);
-      if (itemIndex === 0) {
-        setActiveId(undefined);
-      } else if (itemIndex === -1) {
-        setActiveId(itemOffsets.current[itemOffsets.current.length - 1].id);
-      } else {
-        setActiveId(itemOffsets.current[itemIndex - 1].id);
-      }
-    };
-
-    getItemOffsets();
-    window.addEventListener('resize', getItemOffsets);
-    window.addEventListener('scroll', onScroll);
-
-    return () => {
-      window.removeEventListener('resize', getItemOffsets);
-      window.removeEventListener('scroll', onScroll);
-    };
-  }, []);
-
-  return (
-    <nav>
-      <div>
-        <h4>Contents</h4>
-        <ul>
-          {headers
-            .filter(({ depth }) => depth > 1 && depth < 5)
-            .map((header) => (
-              <li class={`header-link depth-${header.depth} ${activeId === header.slug ? 'active' : ''}`.trim()}>
-                <a href={`#${header.slug}`}>{header.text}</a>
-              </li>
-            ))}
-        </ul>
-      </div>
-      <div>
-        <EditOnGithub href={editHref} />
-      </div>
-    </nav>
-  );
-};
-
-export default DocSidebar;
-- 
cgit v1.2.3

