From 1b6bc6c4b5f598c1515e155fe85a0e4f6f0f41ae Mon Sep 17 00:00:00 2001 From: Bassim Shahidy <122117267+AVGVSTVS96@users.noreply.github.com> Date: Sun, 31 Mar 2024 02:14:26 -0400 Subject: [PATCH] Use `CommandMenu` and `SideMenu` in `NavBar.astro` (#112) * Import `CommandMenu` and `SideMenu` in `NavBar`, use name instead of astro logo in `NavBar` * Use w-dvw to fix layout shift when opening `CommandMenu` * set `h-9` to avoid vertical layout shift on logo h1 * `package.json` - update preview script to build then preview * Set loop prop on `CommandPrimitive` so arrow keys wrap around list --- package.json | 4 +-- src/components/NavBar.astro | 50 +++++++++++++---------------------- src/components/ui/command.tsx | 1 + src/layouts/BaseLayout.astro | 2 +- 4 files changed, 22 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 4d82f352..01190c8e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "astro dev", "start": "astro dev", "build": "astro build", - "preview": "astro preview", + "preview": "astro build && astro preview", "check": "astro check", "astro": "astro", "release": "semantic-release", @@ -58,4 +58,4 @@ "type-coverage": "^2.27.1", "wrangler": "^3.34.2" } -} +} \ No newline at end of file diff --git a/src/components/NavBar.astro b/src/components/NavBar.astro index 3bcbd450..6d6a2c06 100644 --- a/src/components/NavBar.astro +++ b/src/components/NavBar.astro @@ -4,6 +4,8 @@ import DropdownMenu from './DropdownMenu.astro'; import ThemeToggle from './ThemeToggle.astro'; import ThemeSwitcher from './ThemeSwitcher.astro'; import { Icon } from 'astro-icon/components'; +import { CommandMenu } from '@components/CommandMenu'; +import { SideMenu } from '@components/SideMenu'; import type { HTMLAttributes } from 'astro/types'; type Props = HTMLAttributes<'div'>; @@ -12,29 +14,26 @@ const { ...attrs } = Astro.props; ---