From 6c6254bbafd034b8a4da62f9e9e6b4c8396fa717 Mon Sep 17 00:00:00 2001 From: Irfan Khan Date: Sun, 6 Oct 2024 21:45:28 +0100 Subject: [PATCH] Navigation component uses primitive components to enable dropdown menu with list of items --- .../components/navmenu/NavigationMenu.tsx | 62 ++++++++++++++++--- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/src/custom/docs/components/navmenu/NavigationMenu.tsx b/src/custom/docs/components/navmenu/NavigationMenu.tsx index 0a6a731..4139245 100644 --- a/src/custom/docs/components/navmenu/NavigationMenu.tsx +++ b/src/custom/docs/components/navmenu/NavigationMenu.tsx @@ -3,13 +3,17 @@ import { NavigationMenu, NavigationMenuItem, NavigationMenuLink, + NavigationMenuTrigger, NavigationMenuList, - navigationMenuTriggerStyle, + NavigationMenuContent, + cn } from 'src' import { Link } from './config' import { NavConfig } from './schema' +import React from 'react'; + export const Navigation = (props: { activePath: string linkComponent: Link @@ -23,15 +27,27 @@ export const Navigation = (props: { { props.navTextLinks.map((item) => { return ( - - - {item.title} - - + {item.title} + + + ) })} @@ -39,3 +55,29 @@ export const Navigation = (props: { ) } + +const ListItem = React.forwardRef< + React.ElementRef<"a">, + React.ComponentPropsWithoutRef<"a"> +>(({ className, title, children, ...props }, ref) => { + return ( +
  • + + +
    {title}
    +

    + {children} +

    +
    +
    +
  • + ); +}); +ListItem.displayName = "ListItem"; \ No newline at end of file