From 23d2289b64db44f55ee2c4a873e39003c313941c Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 29 Mar 2024 16:54:42 +0100 Subject: [PATCH] Command thing --- src/app/page.tsx | 2 +- src/components/layout/header.tsx | 5 +++-- src/components/layout/nav.tsx | 31 +++++++++++++++++-------------- src/components/navlinks.tsx | 10 ++++------ 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 05538bc..6006b7e 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,7 +2,7 @@ export default function Home() { return ( <>
-

Hello, I am a

+

Hello, I am a

); diff --git a/src/components/layout/header.tsx b/src/components/layout/header.tsx index 8d57459..9dfd7a3 100644 --- a/src/components/layout/header.tsx +++ b/src/components/layout/header.tsx @@ -30,9 +30,10 @@ const Header = () => (
    - {NavLinks.map((link) => ( + {NavLinks.map((link, index) => (
  • ( size="icon" className="transition-opacity hover:bg-transparent hover:opacity-75" > - {link.icon} +
  • diff --git a/src/components/layout/nav.tsx b/src/components/layout/nav.tsx index 6ac0609..b2043d6 100644 --- a/src/components/layout/nav.tsx +++ b/src/components/layout/nav.tsx @@ -1,7 +1,5 @@ "use client"; -import { useState } from "react"; - import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; @@ -18,17 +16,13 @@ import { GalleryHorizontalEnd, Home, SunMoon } from "lucide-react"; import { useRouter } from "next/navigation"; import { useActionCommand } from "@/hooks/useActionCommand"; import { useTheme } from "next-themes"; +import NavLinks from "../navlinks"; type NavCommandProps = { className?: string; }; -const NavCommand: React.FC = ({ - className, - ...props -}) => { - const [value, setValue] = useState(""); - +const NavCommand: React.FC = ({ className, ...props }) => { const router = useRouter(); const { open: actionOpen, setOpen: setActionOpen } = useActionCommand(); const { theme, setTheme } = useTheme(); @@ -61,12 +55,7 @@ const NavCommand: React.FC = ({ - { - setValue(search); - }} - /> + = ({ ⌘L + + + {NavLinks.map((link) => ( + { + router.push(link.href); + })} + > + + {link.label} + + ))} + diff --git a/src/components/navlinks.tsx b/src/components/navlinks.tsx index 5e18dee..55cfb12 100644 --- a/src/components/navlinks.tsx +++ b/src/components/navlinks.tsx @@ -6,27 +6,25 @@ import { FaXTwitter } from "react-icons/fa6"; type NavLink = { label: string; - icon: React.ReactNode; + icon: React.FC<{ className?: string }>; href: string; }; -const IconClassname = "w-5 h-5"; - const NavLinks: NavLink[] = [ { label: "GitHub", href: "https://github.com/almqv", - icon: , + icon: GitHub, }, { label: "LinkedIn", href: "https://www.linkedin.com/in/almqv/", - icon: , + icon: LinkedInLogoIcon, }, { label: "X", href: "https://x.com/fcvprzhfgsybj", - icon: , + icon: FaXTwitter, }, ];