diff options
author | 2023-06-06 11:21:19 -0500 | |
---|---|---|
committer | 2023-06-06 11:21:19 -0500 | |
commit | 5ed2a2f666707e579e18f2890ab89b7cc6f717c3 (patch) | |
tree | 9895d49bc5bd33a63ff0f2e94053e771a54b9dc4 /examples/docs/src/components/LeftSidebar/LeftSidebar.astro | |
parent | d5a089810f8218f694ac56591648d36051708560 (diff) | |
download | astro-5ed2a2f666707e579e18f2890ab89b7cc6f717c3.tar.gz astro-5ed2a2f666707e579e18f2890ab89b7cc6f717c3.tar.zst astro-5ed2a2f666707e579e18f2890ab89b7cc6f717c3.zip |
chore: remove docs example (#7306)
Diffstat (limited to 'examples/docs/src/components/LeftSidebar/LeftSidebar.astro')
-rw-r--r-- | examples/docs/src/components/LeftSidebar/LeftSidebar.astro | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/examples/docs/src/components/LeftSidebar/LeftSidebar.astro b/examples/docs/src/components/LeftSidebar/LeftSidebar.astro deleted file mode 100644 index 128fc0dac..000000000 --- a/examples/docs/src/components/LeftSidebar/LeftSidebar.astro +++ /dev/null @@ -1,119 +0,0 @@ ---- -import { getLanguageFromURL } from '../../languages'; -import { SIDEBAR } from '../../consts'; - -type Props = { - currentPage: string; -}; - -const { currentPage } = Astro.props; -const currentPageMatch = currentPage.endsWith('/') - ? currentPage.slice(1, -1) - : currentPage.slice(1); -const langCode = getLanguageFromURL(currentPage); -const sidebar = SIDEBAR[langCode]; ---- - -<nav aria-labelledby="grid-left"> - <ul class="nav-groups"> - { - Object.entries(sidebar).map(([header, children]) => ( - <li> - <div class="nav-group"> - <h2 class="nav-group-title">{header}</h2> - <ul> - {children.map((child) => { - const url = Astro.site?.pathname + child.link; - return ( - <li class="nav-link"> - <a href={url} aria-current={currentPageMatch === child.link ? 'page' : false}> - {child.text} - </a> - </li> - ); - })} - </ul> - </div> - </li> - )) - } - </ul> -</nav> - -<script is:inline> - window.addEventListener('DOMContentLoaded', () => { - var target = document.querySelector('[aria-current="page"]'); - if (target && target.offsetTop > window.innerHeight - 100) { - document.querySelector('.nav-groups').scrollTop = target.offsetTop; - } - }); -</script> - -<style> - nav { - width: 100%; - margin-right: 1rem; - } - - .nav-groups { - height: 100%; - padding: 2rem 0; - overflow-x: visible; - overflow-y: auto; - max-height: 100vh; - } - - .nav-groups > li + li { - margin-top: 2rem; - } - - .nav-groups > :first-child { - padding-top: var(--doc-padding); - } - - .nav-groups > :last-child { - padding-bottom: 2rem; - margin-bottom: var(--theme-navbar-height); - } - - .nav-group-title { - font-size: 1rem; - font-weight: 700; - padding: 0.1rem 1rem; - text-transform: uppercase; - margin-bottom: 0.5rem; - } - - .nav-link a { - font-size: 1rem; - margin: 1px; - padding: 0.3rem 1rem; - font: inherit; - color: inherit; - text-decoration: none; - display: block; - } - - .nav-link a:hover, - .nav-link a:focus { - background-color: var(--theme-bg-hover); - } - - .nav-link a[aria-current='page'] { - color: var(--theme-text-accent); - background-color: var(--theme-bg-accent); - font-weight: 600; - } - - @media (min-width: 50em) { - .nav-groups { - padding: 0; - } - } -</style> - -<style is:global> - :root.theme-dark .nav-link a[aria-current='page'] { - color: hsla(var(--color-base-white), 100%, 1); - } -</style> |