docs: Enhanced CSR Layout (#1908)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
7d954584a6
commit
eb41b65d4c
@@ -6,6 +6,8 @@ import {
|
||||
import SearchButton from "../islands/SearchButton.tsx";
|
||||
import VersionSelect from "../islands/VersionSelect.tsx";
|
||||
import { type VersionLink } from "../routes/docs/[...slug].tsx";
|
||||
import { Logo } from "$fresh/www/components/Header.tsx";
|
||||
import DocsTitle from "$fresh/www/components/DocsTitle.tsx";
|
||||
|
||||
export default function DocsSidebar(
|
||||
props: {
|
||||
@@ -16,55 +18,29 @@ export default function DocsSidebar(
|
||||
) {
|
||||
return (
|
||||
<>
|
||||
{props.mobile
|
||||
? (
|
||||
<button
|
||||
type="button"
|
||||
class="bg-gray-200 font-bold text-gray-400 rounded-full py-1 px-2 w-full mb-2"
|
||||
>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html:
|
||||
`document.currentScript.parentNode.onclick = function () {
|
||||
document.querySelector(".DocSearch.DocSearch-Button").click()
|
||||
}`,
|
||||
}}
|
||||
<div class="fixed w-[17rem] md:flex h-screen overflow-hidden ">
|
||||
<div class="flex-1 h-screen overflow-y-auto">
|
||||
<div class="sticky mb-4 top-0 bg-white z-10">
|
||||
<div class=" py-4 flex items-center">
|
||||
<Logo />
|
||||
<DocsTitle />
|
||||
</div>
|
||||
<hr />
|
||||
</div>
|
||||
<SearchButton class="mr-4 sm:mr-0" />
|
||||
<div class="mb-4">
|
||||
<VersionSelect
|
||||
selectedVersion={props.selectedVersion}
|
||||
versions={props.versionLinks}
|
||||
/>
|
||||
<span class="DocSearch-Button-Container">
|
||||
<svg
|
||||
width="20"
|
||||
height="20"
|
||||
class="DocSearch-Search-Icon"
|
||||
viewBox="0 0 20 20"
|
||||
>
|
||||
<path
|
||||
d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z"
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
</path>
|
||||
</svg>
|
||||
<span class="DocSearch-Button-Placeholder">Search</span>
|
||||
</span>
|
||||
</button>
|
||||
)
|
||||
: <SearchButton />}
|
||||
|
||||
<div class="mb-4">
|
||||
<VersionSelect
|
||||
selectedVersion={props.selectedVersion}
|
||||
versions={props.versionLinks}
|
||||
/>
|
||||
</div>
|
||||
<ul class="list-inside font-semibold nested ml-2.5">
|
||||
{CATEGORIES[props.selectedVersion].map((category) => (
|
||||
<SidebarCategory key={category.href} category={category} />
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="list-inside font-semibold nested ml-2.5">
|
||||
{CATEGORIES[props.selectedVersion].map((category) => (
|
||||
<SidebarCategory key={category.href} category={category} />
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user