www: update docs design (#1423)

This commit is contained in:
Marvin Hagemeister
2023-07-10 11:07:49 +02:00
committed by GitHub
parent 4b18dc8b79
commit f061667822
7 changed files with 47 additions and 39 deletions
+11 -7
View File
@@ -52,7 +52,7 @@ export default function DocsSidebar(
</span>
</button>
)
: <SearchButton />}
: <SearchButton class="lg:hidden" />}
<div class="mb-4">
<VersionSelect
@@ -61,7 +61,7 @@ export default function DocsSidebar(
/>
</div>
<ol class="list-decimal list-inside font-semibold nested">
<ol class="list-decimal list-inside font-semibold nested ml-2.5">
{CATEGORIES[props.selectedVersion].map((category) => (
<SidebarCategory path={props.path} category={category} />
))}
@@ -71,7 +71,7 @@ export default function DocsSidebar(
}
const link = "text(gray-900 hover:gray-600)";
const linkActive = "text(green-600 hover:green-500)";
const linkActive = "text(green-600 hover:green-500) font-bold";
export function SidebarCategory(props: {
path: string;
@@ -83,9 +83,11 @@ export function SidebarCategory(props: {
return (
<li class="my-2 block">
<a href={href} class={outerLink}>{title}</a>
<a href={href} class={outerLink}>
{title}
</a>
{entries.length > 0 && (
<ol class="pl-4 list-decimal nested">
<ol class="pb-2 pl-4 list-decimal nested list-outside">
{entries.map((entry) => (
<SidebarEntry path={props.path} entry={entry} />
))}
@@ -101,10 +103,12 @@ export function SidebarEntry(props: {
}) {
const { title, href } = props.entry;
const innerLink = `${href == props.path ? linkActive : link} font-normal`;
const innerLink = `${
href == props.path ? linkActive : link
} transition-colors hover:text-green-500 font-normal`;
return (
<li class="my-0.5">
<li class="py-0.5">
<a href={href} class={innerLink}>{title}</a>
</li>
);
+11 -14
View File
@@ -1,21 +1,23 @@
import DocsTitle from "./DocsTitle.tsx";
import NavigationBar from "./NavigationBar.tsx";
import SearchButton from "../islands/SearchButton.tsx";
export default function Header(props: { title: string; active: string }) {
const isHome = props.active == "/";
const isDocs = props.active.startsWith("/docs");
return (
<div>
<header
class={"mx-auto max-w-screen-lg flex gap-3 " +
class={"mx-auto max-w-screen-xl flex gap-3 items-center " +
(isHome ? "justify-end" : "justify-between")}
>
{!isHome &&
(
<div class="p-4 flex items-center">
<Logo />
<DocsTitle title={props.title} />
</div>
)}
{!isHome && (
<div class="p-4 flex items-center">
<Logo />
<DocsTitle title={props.title} />
</div>
)}
{isDocs && <SearchButton class="grow mb-0 hidden lg:flex" />}
<NavigationBar class="hidden md:flex" active={props.active} />
</header>
<NavigationBar class="md:hidden pb-3" active={props.active} />
@@ -26,12 +28,7 @@ export default function Header(props: { title: string; active: string }) {
function Logo() {
return (
<a href="/" class="flex mr-3 items-center" aria-label="Top Page">
<img
src="/logo.svg"
alt="Fresh logo"
width={40}
height={40}
/>
<img src="/logo.svg" alt="Fresh logo" width={40} height={40} />
</a>
);
}