From 57bf60fd54120c11fc2c7770eeec7bf28438f77e Mon Sep 17 00:00:00 2001 From: Saif Ali Shaik Date: Mon, 22 Sep 2025 16:12:44 +0530 Subject: [PATCH 1/6] Enhance Secondary Navigation with Dropdown Functionality - Added support for dropdown menus in the secondary navigation component. - Introduced `IconChevronDown` for indicating dropdown items. - Updated navigation structure to include child items for better organization. - Implemented dropdown visibility control with JavaScript for improved user interaction. - Enhanced styling for dropdown menus and icons to improve visual clarity. --- src/components/SecondaryNav.astro | 298 +++++++++++++++++++++++++++--- 1 file changed, 273 insertions(+), 25 deletions(-) diff --git a/src/components/SecondaryNav.astro b/src/components/SecondaryNav.astro index f1b1742d..054eccb1 100644 --- a/src/components/SecondaryNav.astro +++ b/src/components/SecondaryNav.astro @@ -1,5 +1,6 @@ --- import IconHouse from '~icons/lucide/house' +import IconChevronDown from '~icons/lucide/chevron-down' interface NavItem { href: string @@ -7,6 +8,7 @@ interface NavItem { patterns: string[] isExact?: boolean iconComponent?: any + children?: NavItem[] } interface NavSection { @@ -26,6 +28,11 @@ function startsWithAny(mainString: string, patterns: string[]) { } function isCurrentPage(pathname: string, item: NavItem): boolean { + // If this is a parent item with children, consider it current if any child is current + if (item.children && item.children.length > 0) { + return item.children.some((child) => isCurrentPage(pathname, child)) + } + if (item.isExact) { return pathname === item.href } @@ -43,22 +50,40 @@ const navSections: NavSection[] = [ items: [ { href: '/', label: '', patterns: ['/'], isExact: true, iconComponent: IconHouse }, - { href: '/mcp/overview', label: 'MCP Auth', patterns: ['/mcp/'] }, - { href: '/fsa/quickstart', label: 'Full-Stack Auth', patterns: ['/fsa/'] }, - { - href: '/sso/quickstart', - label: 'SSO', - patterns: ['/sso/', '/guides/sso/', '/social-logins/'], - }, { - href: '/passwordless/quickstart', - label: 'Passwordless', - patterns: ['/passwordless/', '/guides/passwordless/'], - }, - { - href: '/directory/scim/quickstart', - label: 'SCIM', - patterns: ['/directory/', '/guides/directory/'], + href: '/fsa/quickstart', + label: 'Authenticate', + // Parent patterns include all child patterns so it highlights correctly + patterns: [ + '/mcp/', + '/fsa/', + '/sso/', + '/guides/sso/', + '/social-logins/', + '/passwordless/', + '/guides/passwordless/', + '/directory/', + '/guides/directory/', + ], + children: [ + { href: '/mcp/overview', label: 'MCP Auth', patterns: ['/mcp/'] }, + { href: '/fsa/quickstart', label: 'Full-Stack Auth', patterns: ['/fsa/'] }, + { + href: '/sso/quickstart', + label: 'SSO', + patterns: ['/sso/', '/guides/sso/', '/social-logins/'], + }, + { + href: '/passwordless/quickstart', + label: 'Passwordless', + patterns: ['/passwordless/', '/guides/passwordless/'], + }, + { + href: '/directory/scim/quickstart', + label: 'SCIM', + patterns: ['/directory/', '/guides/directory/'], + }, + ], }, { href: '/agent-actions/quickstart', label: 'Agent Actions', patterns: ['/agent-actions/'] }, ], @@ -83,22 +108,56 @@ const navSections: NavSection[] = [ navSections.map((section) => ( ))} )) } + + + + + From 1a0c7b148d293fee16891ba55a713669a9d849ad Mon Sep 17 00:00:00 2001 From: Saif Ali Shaik Date: Mon, 22 Sep 2025 16:15:57 +0530 Subject: [PATCH 2/6] Remove gap property from SecondaryNav component for improved layout consistency --- src/components/SecondaryNav.astro | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/SecondaryNav.astro b/src/components/SecondaryNav.astro index 054eccb1..4fdb0be4 100644 --- a/src/components/SecondaryNav.astro +++ b/src/components/SecondaryNav.astro @@ -228,7 +228,6 @@ const navSections: NavSection[] = [ .nav-item-content { display: flex; align-items: center; - gap: 0.5rem; line-height: 1.2; } From 811bffd60e42eb56b30d734d0f23a989b4d79c48 Mon Sep 17 00:00:00 2001 From: Saif Ali Shaik Date: Mon, 22 Sep 2025 16:23:00 +0530 Subject: [PATCH 3/6] Enhance SecondaryNav component to dynamically display labels for dropdown items - Introduced `getDisplayLabel` function to determine the appropriate label for navigation items with children. - Updated rendering logic to show the correct label based on active child items. - Modified dropdown menu key attribute for improved accessibility and functionality. --- src/components/SecondaryNav.astro | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/SecondaryNav.astro b/src/components/SecondaryNav.astro index 4fdb0be4..1e045f1a 100644 --- a/src/components/SecondaryNav.astro +++ b/src/components/SecondaryNav.astro @@ -45,6 +45,14 @@ function isCurrentPage(pathname: string, item: NavItem): boolean { return startsWithAny(pathname, item.patterns) } +function getDisplayLabel(pathname: string, item: NavItem): string { + if (item.children && item.children.length > 0) { + const activeChild = item.children.find((child) => isCurrentPage(pathname, child)) + if (activeChild) return activeChild.label + } + return item.label +} + const navSections: NavSection[] = [ { items: [ @@ -118,7 +126,13 @@ const navSections: NavSection[] = [ >