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}
</a>
{entries.length > 0 && (
<ul class="py-2 pl-4 nested list-outside">
<ul class="py-2 nested list-outside">
{entries.map((entry) => (
<SidebarEntry key={entry.href} entry={entry} />
))}
@@ -99,10 +99,10 @@ export function SidebarEntry(props: {
const { title, href } = props.entry;
return (
<li class="py-0.5">
<li class="py-[1px]">
<a
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}
</a>
+2 -2
View File
@@ -24,12 +24,12 @@ export default function NavigationBar(
const isHome = props.active == "/";
return (
<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) => (
<li>
<a
href={item.href}
class={`p-2 ${
class={`p-1 sm:p-2 ${
isHome ? "text-green-900" : "text-gray-600"
} hover:underline [data-current]:font-bold [data-ancestor]:font-bold`}
>
+4 -4
View File
@@ -168,10 +168,10 @@ function Main(props: { page: Page }) {
return (
<div class="flex-1">
<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
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
class="h-6 w-6"
@@ -187,7 +187,7 @@ function Main(props: { page: Page }) {
>
</path>
</svg>
<div>Menu</div>
<div>Table of Contents</div>
</label>
</div>
<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);
return (
<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}
</h1>
<div