Files
sweet/www/components/NavigationBar.tsx
T
Christian Svensson 349372ad82 style: fix horizontal scrollbar for some screen sizes (#3177)
On the Fresh docs, I get a vertical scrollbar for a small range of
viewport size of the browser. This is annoying me, since I get it when I
place two windows next to each other on a 21:9 screen.

The issue seems to stem from a button using `p-1 -m-1`. But the negative
margin is there to address the increased space due to making the button
easier to click (most likely for touch/mobile). But this makes the
button overflow when there is no right-margin (`2xl:mr-0`).

<img width="1637" height="661" alt="image"
src="https://github.com/user-attachments/assets/48773cf5-316d-41f3-99e0-54f49b1f2cc9"
/>

## Solution

The simplest and easiest fix here is just to increase the margin to
cover for this case. `2xl:mr-1` seems to do the trick. But it might be a
good idea to have a little more gap towards the edge of the screen, e.g.
`2xl-mr-2`.
2025-08-05 23:49:13 +02:00

70 lines
1.8 KiB
TypeScript

import ThemeToggle from "../islands/ThemeToggle.tsx";
import * as Icons from "./Icons.tsx";
export default function NavigationBar(
props: { active: string; class?: string },
) {
const items = [
{
name: "Docs",
href: "/docs",
},
{
name: "Showcase",
href: "/showcase",
},
{
name: "Blog",
href: "https://deno.com/blog?tag=fresh",
},
];
const isHome = props.active == "/";
const isDocs = props.active == "/docs";
return (
<nav class={"flex " + (props.class ?? "")} f-client-nav={false}>
<ul class="flex items-center gap-x-2 sm:gap-4 mx-4 my-2 sm:my-6 flex-wrap lg:mx-8 2xl:mr-1">
{items.map((item) => (
<li key={item.name}>
<a
href={item.href}
class={`p-1 sm:p-2 ${
isHome
? "text-green-900"
: isDocs
? "text-foreground-secondary"
: "text-gray-600"
} hover:underline aria-[current]:font-bold`}
>
{item.name}
</a>
</li>
))}
<li class="flex items-center">
<a
href="https://github.com/denoland/fresh"
class="hover:text-green-600 inline-block transition"
aria-label="GitHub"
>
<Icons.GitHub />
</a>
</li>
<li class="flex items-center">
<a
href="https://discord.com/invite/deno"
class="hover:text-green-600 inline-block transition"
aria-label="Discord"
>
<Icons.Discord />
</a>
</li>
{isDocs && (
<li class="flex items-center">
<ThemeToggle />
</li>
)}
</ul>
</nav>
);
}