Major changes include enhancements to the UI and modifications to the i18n loading logic to more effectively handle namespaces. Several components were updated to improve readability and layout consistency. The i18n loading logic now includes additional handling for waiting until all namespaces are loaded before the i18n instance is returned, with a warning if it takes longer than expected. Furthermore, code have been refactored for fonts, buttons, and other UI elements.
88 lines
2.1 KiB
TypeScript
88 lines
2.1 KiB
TypeScript
import Link from 'next/link';
|
|
|
|
import { Menu } from 'lucide-react';
|
|
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
} from '@kit/ui/dropdown-menu';
|
|
import { NavigationMenu, NavigationMenuList } from '@kit/ui/navigation-menu';
|
|
import { Trans } from '@kit/ui/trans';
|
|
|
|
import { SiteNavigationItem } from './site-navigation-item';
|
|
|
|
const links = {
|
|
Blog: {
|
|
label: 'marketing:blog',
|
|
path: '/blog',
|
|
},
|
|
Docs: {
|
|
label: 'marketing:documentation',
|
|
path: '/docs',
|
|
},
|
|
Pricing: {
|
|
label: 'marketing:pricing',
|
|
path: '/pricing',
|
|
},
|
|
FAQ: {
|
|
label: 'marketing:faq',
|
|
path: '/faq',
|
|
},
|
|
Contact: {
|
|
label: 'marketing:contact',
|
|
path: '/contact',
|
|
}
|
|
};
|
|
|
|
export function SiteNavigation() {
|
|
const NavItems = Object.values(links).map((item) => {
|
|
return (
|
|
<SiteNavigationItem key={item.path} path={item.path}>
|
|
<Trans i18nKey={item.label} />
|
|
</SiteNavigationItem>
|
|
);
|
|
});
|
|
|
|
return (
|
|
<>
|
|
<div className={'hidden items-center justify-center md:flex'}>
|
|
<NavigationMenu className={'border border-gray-100 dark:border-primary/10 rounded-full py-2 px-4'}>
|
|
<NavigationMenuList className={'space-x-1'}>
|
|
{NavItems}
|
|
</NavigationMenuList>
|
|
</NavigationMenu>
|
|
</div>
|
|
|
|
<div className={'flex justify-start sm:items-center md:hidden'}>
|
|
<MobileDropdown />
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
function MobileDropdown() {
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger aria-label={'Open Menu'}>
|
|
<Menu className={'h-8 w-8'} />
|
|
</DropdownMenuTrigger>
|
|
|
|
<DropdownMenuContent className={'w-full'}>
|
|
{Object.values(links).map((item) => {
|
|
const className = 'flex w-full h-full items-center';
|
|
|
|
return (
|
|
<DropdownMenuItem key={item.path} asChild>
|
|
<Link className={className} href={item.path}>
|
|
<Trans i18nKey={item.label} />
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
);
|
|
})}
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
);
|
|
}
|