various changes
This commit is contained in:
@@ -43,13 +43,13 @@ const { title, description, image } = Astro.props;
|
||||
class="antialiased flex flex-col items-center justify-center mx-auto mt-2 lg:mt-8 mb-20 lg:mb-40
|
||||
scrollbar-hide">
|
||||
<main
|
||||
class="flex-auto min-w-0 mt-2 md:mt-6 flex flex-col px-6 sm:px-4 md:px-0 max-w-[640px] w-full">
|
||||
class="flex-auto min-w-0 mt-2 md:mt-6 flex flex-col px-6 sm:px-4 md:px-0 max-w-2xl w-full">
|
||||
<noscript>
|
||||
<div style="background: #f44336; color: white; padding: 1em; text-align: center;">
|
||||
This site requires JavaScript to function. Please enable JavaScript in your browser.
|
||||
</div>
|
||||
</noscript>
|
||||
<Navbar />
|
||||
<Navbar />
|
||||
<slot />
|
||||
<Footer />
|
||||
</main>
|
||||
|
||||
@@ -7,11 +7,12 @@ const navItems = [
|
||||
{ label: "Home", href: "/" },
|
||||
{ label: "Radio", href: "/radio" },
|
||||
{ label: "Memes", href: "/memes" },
|
||||
{ blockSeparator: true },
|
||||
{ label: "TRip", href: "/TRip", auth: true },
|
||||
{ label: "Status", href: "https://status.boatson.boats", icon: ExitToApp },
|
||||
{ label: "Git", href: "https://kode.boatson.boats", icon: ExitToApp },
|
||||
];
|
||||
|
||||
|
||||
const currentPath = Astro.url.pathname;
|
||||
---
|
||||
<script is:inline>
|
||||
@@ -29,20 +30,21 @@ const currentPath = Astro.url.pathname;
|
||||
|
||||
<ul class="flex flex-wrap items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300">
|
||||
{navItems.map((item, index) => {
|
||||
if (item.blockSeparator) {
|
||||
return (
|
||||
<li class="text-neutral-500 dark:text-neutral-500 px-2 select-none" aria-hidden="true">
|
||||
‖
|
||||
</li>
|
||||
);
|
||||
}
|
||||
// if (item.blockSeparator) {
|
||||
// return (
|
||||
// <li class="text-neutral-500 dark:text-neutral-500 px-2 select-none" aria-hidden="true">
|
||||
// ‖
|
||||
// </li>
|
||||
// );
|
||||
// }
|
||||
|
||||
const isExternal = item.href?.startsWith("http");
|
||||
const isAuthedPath = item.auth ?? false;
|
||||
const normalize = (url) => url?.replace(/\/+$/, '') || '/';
|
||||
const isActive = !isExternal && normalize(item.href) === normalize(currentPath);
|
||||
|
||||
const nextItem = navItems[index + 1];
|
||||
const shouldShowThinBar = nextItem && !nextItem.blockSeparator;
|
||||
const shouldShowThinBar = nextItem //&& !nextItem.blockSeparator;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -53,7 +55,7 @@ const currentPath = Astro.url.pathname;
|
||||
hover:bg-neutral-200 dark:hover:bg-neutral-800
|
||||
${isActive ? "font-semibold underline underline-offset-4" : ""}`}
|
||||
target={isExternal ? "_blank" : undefined}
|
||||
rel={isExternal ? "noopener noreferrer" : undefined}
|
||||
rel={(isExternal || isAuthedPath) ? "external" : undefined}
|
||||
>
|
||||
{item.label}
|
||||
{item.icon === ExitToApp && <ExitToApp className="w-4 h-4" client:load />}
|
||||
|
||||
Reference in New Issue
Block a user