From fe8339f86a67aec71499702cc136c7255f6dc87c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 8 Jan 2026 16:03:47 +0000 Subject: [PATCH] Refactor navigation to use config-driven components Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- src/app/[locale]/(marketing)/layout.tsx | 77 ++++++------------------- src/components/NavLink.tsx | 34 +++++++++++ src/config/navigation.ts | 61 ++++++++++++++++++++ src/config/styles.ts | 4 ++ 4 files changed, 117 insertions(+), 59 deletions(-) create mode 100644 src/components/NavLink.tsx create mode 100644 src/config/navigation.ts diff --git a/src/app/[locale]/(marketing)/layout.tsx b/src/app/[locale]/(marketing)/layout.tsx index f68e025..210ca22 100644 --- a/src/app/[locale]/(marketing)/layout.tsx +++ b/src/app/[locale]/(marketing)/layout.tsx @@ -1,7 +1,9 @@ import { getTranslations, setRequestLocale } from 'next-intl/server'; -import Link from 'next/link'; import { DemoBanner } from '@/components/DemoBanner'; import { LocaleSwitcher } from '@/components/LocaleSwitcher'; +import { NavLink } from '@/components/NavLink'; +import { marketingNavigation } from '@/config/navigation'; +import { styles } from '@/config/styles'; import { BaseTemplate } from '@/templates/BaseTemplate'; export default async function Layout(props: { @@ -21,67 +23,24 @@ export default async function Layout(props: { -
  • - - {t('home_link')} - -
  • -
  • - - {t('about_link')} - -
  • -
  • - - {t('counter_link')} - -
  • -
  • - - {t('portfolio_link')} - -
  • -
  • - - GitHub - -
  • + {marketingNavigation.left.map(link => ( +
  • + + {link.label || t(link.translationKey)} + +
  • + ))} )} rightNav={( <> -
  • - - {t('sign_in_link')} - -
  • - -
  • - - {t('sign_up_link')} - -
  • + {marketingNavigation.right.map(link => ( +
  • + + {t(link.translationKey)} + +
  • + ))}
  • @@ -89,7 +48,7 @@ export default async function Layout(props: { )} > -
    {props.children}
    +
    {props.children}
    ); diff --git a/src/components/NavLink.tsx b/src/components/NavLink.tsx new file mode 100644 index 0000000..f231163 --- /dev/null +++ b/src/components/NavLink.tsx @@ -0,0 +1,34 @@ +import Link from 'next/link'; +import { styles } from '@/config/styles'; + +type NavLinkProps = { + href: string; + children: React.ReactNode; + external?: boolean; +}; + +/** + * Navigation link component with consistent styling + * Used for navigation menus in layouts + */ +export function NavLink({ href, children, external }: NavLinkProps) { + if (external) { + return ( + + {children} + + ); + } + + return ( + + {children} + + ); +} diff --git a/src/config/navigation.ts b/src/config/navigation.ts new file mode 100644 index 0000000..fedf69a --- /dev/null +++ b/src/config/navigation.ts @@ -0,0 +1,61 @@ +/** + * Navigation configuration for marketing layout + * Defines navigation items for left and right navigation menus + */ + +export type NavLink = { + id: string; + translationKey: string; + href: string; + external?: boolean; + label?: string; // For links without translation (like GitHub) +}; + +export type NavigationConfig = { + left: NavLink[]; + right: NavLink[]; +}; + +export const marketingNavigation: NavigationConfig = { + left: [ + { + id: 'home', + translationKey: 'home_link', + href: '/', + }, + { + id: 'about', + translationKey: 'about_link', + href: '/about/', + }, + { + id: 'counter', + translationKey: 'counter_link', + href: '/counter/', + }, + { + id: 'portfolio', + translationKey: 'portfolio_link', + href: '/portfolio/', + }, + { + id: 'github', + label: 'GitHub', + translationKey: '', + href: 'https://github.com/ixartz/Next-js-Boilerplate', + external: true, + }, + ], + right: [ + { + id: 'sign-in', + translationKey: 'sign_in_link', + href: '/sign-in/', + }, + { + id: 'sign-up', + translationKey: 'sign_up_link', + href: '/sign-up/', + }, + ], +}; diff --git a/src/config/styles.ts b/src/config/styles.ts index de61b24..2105a50 100644 --- a/src/config/styles.ts +++ b/src/config/styles.ts @@ -8,6 +8,7 @@ export const styles = { primary: 'text-blue-700 hover:border-b-2 hover:border-blue-700', primaryBold: 'font-bold text-blue-700 hover:border-b-2 hover:border-blue-700', hoverBlue: 'hover:text-blue-700', + nav: 'border-none text-gray-700 hover:text-gray-900', }, text: { centerSmall: 'text-center text-sm', @@ -27,4 +28,7 @@ export const styles = { lists: { baseMarginTop: 'mt-3 text-base', }, + containers: { + contentPadding: 'py-5 text-xl [&_p]:my-6', + }, } as const;