mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Restructured app to work better with localized slugs
This commit is contained in:
@@ -1,19 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import { useTranslations } from 'next-intl';
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function DesktopMenu({ items, locale }: { items: []; locale: string }) {
|
||||
const t = useTranslations('routes');
|
||||
export default function DesktopMenu({ items }: { items: []; locale: string }) {
|
||||
return (
|
||||
<ul className="flex gap-6">
|
||||
{items.map((item: { title: string; slug: string }, i: number) => {
|
||||
return (
|
||||
<li key={i}>
|
||||
<Link
|
||||
className="font-medium underline-offset-2 hover:underline"
|
||||
href={`/${locale}/${t('category')}/${item.slug}`}
|
||||
>
|
||||
<Link className="font-medium underline-offset-2 hover:underline" href={`${item.slug}`}>
|
||||
{item.title}
|
||||
</Link>
|
||||
</li>
|
||||
|
@@ -45,7 +45,7 @@ export default async function Header({ locale }: HeaderProps) {
|
||||
|
||||
<div className="absolute left-1/2 top-1/2 hidden -translate-x-1/2 -translate-y-1/2 transform md:flex">
|
||||
<Suspense>
|
||||
<DesktopMenu items={mainMenu} locale={locale} />
|
||||
<DesktopMenu items={mainMenu} />
|
||||
</Suspense>
|
||||
</div>
|
||||
<div className="flex translate-x-2 transform justify-end space-x-1">
|
||||
|
Reference in New Issue
Block a user