docs: improve sidebar active style (#1888)

This commit is contained in:
Marvin Hagemeister
2023-10-07 21:05:54 +02:00
committed by GitHub
parent cb4dd3299b
commit 534a0d87b3
3 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -83,7 +83,7 @@ export function SidebarCategory(props: {
{title} {title}
</a> </a>
{entries.length > 0 && ( {entries.length > 0 && (
<ul class="py-2 pl-4 nested list-outside"> <ul class="py-2 nested list-outside">
{entries.map((entry) => ( {entries.map((entry) => (
<SidebarEntry key={entry.href} entry={entry} /> <SidebarEntry key={entry.href} entry={entry} />
))} ))}
@@ -99,10 +99,10 @@ export function SidebarEntry(props: {
const { title, href } = props.entry; const { title, href } = props.entry;
return ( return (
<li class="py-0.5"> <li class="py-[1px]">
<a <a
href={href} href={href}
class="[data-current]:text-green-700 transition-colors hover:text-green-500 font-normal" class="[data-current]:text-green-700 [data-current]:border-green-600 [data-current]:bg-green-50 border-l-4 border-transparent px-4 py-0.5 transition-colors hover:text-green-500 font-normal block"
> >
{title} {title}
</a> </a>
+2 -2
View File
@@ -24,12 +24,12 @@ export default function NavigationBar(
const isHome = props.active == "/"; const isHome = props.active == "/";
return ( return (
<nav class={"flex " + props.class ?? ""}> <nav class={"flex " + props.class ?? ""}>
<ul class="flex justify-center items-center gap-4 mx-4 my-6 flex-wrap"> <ul class="flex justify-center items-center gap-2 sm:gap-4 mx-4 my-2 sm:my-6 flex-wrap">
{items.map((item) => ( {items.map((item) => (
<li> <li>
<a <a
href={item.href} href={item.href}
class={`p-2 ${ class={`p-1 sm:p-2 ${
isHome ? "text-green-900" : "text-gray-600" isHome ? "text-green-900" : "text-gray-600"
} hover:underline [data-current]:font-bold [data-ancestor]:font-bold`} } hover:underline [data-current]:font-bold [data-ancestor]:font-bold`}
> >
+4 -4
View File
@@ -168,10 +168,10 @@ function Main(props: { page: Page }) {
return ( return (
<div class="flex-1"> <div class="flex-1">
<MobileSidebar page={props.page} /> <MobileSidebar page={props.page} />
<div class="flex mx-auto max-w-screen-xl px-4 md:px-0 py-5 md:py-0 justify-end"> <div class="flex mx-auto max-w-screen-xl px-4 md:px-0 md:py-0 justify-end bg-gray-100">
<label <label
for="docs_sidebar" for="docs_sidebar"
class="px-4 py-3 md:hidden flex items-center hover:bg-gray-100 rounded gap-2" class="px-4 py-3 md:hidden flex items-center hover:bg-gray-100 rounded gap-2 cursor-pointer"
> >
<svg <svg
class="h-6 w-6" class="h-6 w-6"
@@ -187,7 +187,7 @@ function Main(props: { page: Page }) {
> >
</path> </path>
</svg> </svg>
<div>Menu</div> <div>Table of Contents</div>
</label> </label>
</div> </div>
<div class="mx-auto max-w-screen-xl flex gap-6 md:gap-8"> <div class="mx-auto max-w-screen-xl flex gap-6 md:gap-8">
@@ -247,7 +247,7 @@ function Content(props: { page: Page }) {
const html = renderMarkdown(props.page.markdown); const html = renderMarkdown(props.page.markdown);
return ( return (
<main class="py-6 md:mr-4 lg:mr-32 min-w-0"> <main class="py-6 md:mr-4 lg:mr-32 min-w-0">
<h1 class="text(4xl gray-900) tracking-tight font-extrabold mt-6 md:mt-0 px-4"> <h1 class="text(4xl gray-900) tracking-tight font-extrabold md:mt-0 px-4">
{props.page.title} {props.page.title}
</h1> </h1>
<div <div