Skip to content

Commit

Permalink
fix: close sheet nav with hash url
Browse files Browse the repository at this point in the history
  • Loading branch information
mickasmt committed Sep 15, 2023
1 parent 1be50fc commit 6746597
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { items, className } = Astro.props;

<header
class={cn(
"flex items-center h-14 md:h-18 z-50 sticky top-0 bg-background",
"flex items-center h-16 md:h-18 z-50 sticky top-0 bg-background",
className
)}
>
Expand Down
12 changes: 10 additions & 2 deletions src/components/layout/sheet-mobile-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export function SheetMobileNav() {
{mergedMainNav.map(
(item) =>
item.href && (
<a key={item.href} href={item.href} className="text-muted-foreground">
<a
key={item.href}
href={item.href}
className="text-muted-foreground"
onClick={() => item.href.startsWith("/#") ? setOpen(false) : undefined}
>
{item.title}
</a>
)
Expand All @@ -58,7 +63,10 @@ export function SheetMobileNav() {
<React.Fragment key={item.href + idx}>
{!item.disabled &&
(item.href ? (
<a href={item.href} className="text-muted-foreground">
<a
href={item.href}
className="text-muted-foreground"
>
{item.title}
</a>
) : (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import { cn } from "@/lib/utils";
<h1
class="font-heading text-3xl sm:text-5xl md:text-6xl lg:text-7xl balance-text"
>
A starter template built using Astro 3.0 <span class="font-sans font-bold">+</span> shadcn<span class="font-sans font-bold">/</span>ui.
A mordern example app built using Astro 3.0 <span class="font-sans font-bold">+</span> shadcn<span class="font-sans font-bold">/</span>ui.
</h1>
<p
class="max-w-[42rem] leading-normal text-muted-foreground sm:text-xl sm:leading-8 balance-text"
>
I&apos;m building a starter template with Astro 3.0 and based on
I&apos;m building a mordern example app with Astro 3.0 and based on
shadcn-ui/taxonomy. Follow along as we figure this out together.
</p>
<div class="space-x-4">
Expand Down
5 changes: 5 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
@apply border-border;
}

html {
/* scroll-padding-top: 4rem; */
@apply scroll-pt-16 lg:scroll-pt-0;
}

body {
@apply bg-background text-foreground font-sans;
font-feature-settings: "rlig" 1, "calt" 1;
Expand Down

0 comments on commit 6746597

Please sign in to comment.