mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Iterated with translations
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
export default function LogoIcon({ className }: { className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
aria-label={`${process.env.SITE_NAME} logo`}
|
||||
viewBox="0 0 32 32"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
shapeRendering="geometricPrecision"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 109 80"
|
||||
className={className}
|
||||
>
|
||||
<rect width="100%" height="100%" rx="16" className="fill-black dark:fill-white" />
|
||||
<path
|
||||
className=" fill-white dark:fill-black"
|
||||
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
|
||||
fill="currentColor"
|
||||
d="M54.6,0C32.8,0,15.1,17.9,15.1,40c0,10.6,4.3,18.1,4.6,18.8h20.6c-0.7-0.5-9.1-6.9-9.1-18.8 c0-13.1,10.5-23.7,23.4-23.7S78,26.9,78,40S67.5,63.7,54.6,63.7H0V80h54.6c21.8,0,39.5-17.9,39.5-40S76.5,0,54.6,0z"
|
||||
/>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M109,63.7V80H75.3c7.2-3.7,13.2-9.4,17.4-16.3H109z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
|
@@ -1,20 +0,0 @@
|
||||
export default function VercelIcon({ className }: { className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
aria-label="Vercel.com Logo"
|
||||
viewBox="0 0 89 20"
|
||||
fill="currentColor"
|
||||
shapeRendering="geometricPrecision"
|
||||
className={className}
|
||||
>
|
||||
<path d="M11.5625 0L23.125 20H0L11.5625 0Z" />
|
||||
<path d="M49.875 10.625C49.875 7.40625 47.5 5.15625 44.0937 5.15625C40.6875 5.15625 38.3125 7.40625 38.3125 10.625C38.3125 13.7812 40.875 16.0937 44.4062 16.0937C46.3438 16.0937 48.0938 15.375 49.2188 14.0625L47.0938 12.8437C46.4375 13.5 45.4688 13.9062 44.4062 13.9062C42.8438 13.9062 41.5 13.0625 41.0312 11.7812L40.9375 11.5625H49.7812C49.8438 11.25 49.875 10.9375 49.875 10.625ZM40.9062 9.6875L40.9688 9.5C41.375 8.15625 42.5625 7.34375 44.0625 7.34375C45.5938 7.34375 46.75 8.15625 47.1562 9.5L47.2188 9.6875H40.9062Z" />
|
||||
<path d="M83.5313 10.625C83.5313 7.40625 81.1563 5.15625 77.75 5.15625C74.3438 5.15625 71.9688 7.40625 71.9688 10.625C71.9688 13.7812 74.5313 16.0937 78.0625 16.0937C80 16.0937 81.75 15.375 82.875 14.0625L80.75 12.8437C80.0938 13.5 79.125 13.9062 78.0625 13.9062C76.5 13.9062 75.1563 13.0625 74.6875 11.7812L74.5938 11.5625H83.4375C83.5 11.25 83.5313 10.9375 83.5313 10.625ZM74.5625 9.6875L74.625 9.5C75.0313 8.15625 76.2188 7.34375 77.7188 7.34375C79.25 7.34375 80.4063 8.15625 80.8125 9.5L80.875 9.6875H74.5625Z" />
|
||||
<path d="M68.5313 8.84374L70.6563 7.62499C69.6563 6.06249 67.875 5.18749 65.7188 5.18749C62.3125 5.18749 59.9375 7.43749 59.9375 10.6562C59.9375 13.875 62.3125 16.125 65.7188 16.125C67.875 16.125 69.6563 15.25 70.6563 13.6875L68.5313 12.4687C67.9688 13.4062 66.9688 13.9375 65.7188 13.9375C63.75 13.9375 62.4375 12.625 62.4375 10.6562C62.4375 8.68749 63.75 7.37499 65.7188 7.37499C66.9375 7.37499 67.9688 7.90624 68.5313 8.84374Z" />
|
||||
<path d="M88.2188 1.75H85.7188V15.8125H88.2188V1.75Z" />
|
||||
<path d="M40.1563 1.75H37.2813L31.7813 11.25L26.2813 1.75H23.375L31.7813 16.25L40.1563 1.75Z" />
|
||||
<path d="M57.8438 8.0625C58.125 8.0625 58.4062 8.09375 58.6875 8.15625V5.5C56.5625 5.5625 54.5625 6.75 54.5625 8.21875V5.5H52.0625V15.8125H54.5625V11.3437C54.5625 9.40625 55.9062 8.0625 57.8438 8.0625Z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
@@ -1,70 +0,0 @@
|
||||
import Link from 'next/link';
|
||||
|
||||
import GitHubIcon from 'components/icons/github';
|
||||
import LogoIcon from 'components/icons/logo';
|
||||
import VercelIcon from 'components/icons/vercel';
|
||||
import { getMenu } from 'lib/shopify';
|
||||
import { Menu } from 'lib/shopify/types';
|
||||
|
||||
const { SITE_NAME } = process.env;
|
||||
|
||||
export default async function Footer() {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const copyrightDate = 2023 + (currentYear > 2023 ? `-${currentYear}` : '');
|
||||
const menu = await getMenu('next-js-frontend-footer-menu');
|
||||
|
||||
return (
|
||||
<footer className="border-t border-gray-700 bg-white text-black dark:bg-black dark:text-white">
|
||||
<div className="mx-auto w-full max-w-7xl px-6">
|
||||
<div className="grid grid-cols-1 gap-8 border-b border-gray-700 py-12 transition-colors duration-150 lg:grid-cols-12">
|
||||
<div className="col-span-1 lg:col-span-3">
|
||||
<a className="flex flex-initial items-center font-bold md:mr-24" href="/">
|
||||
<span className="mr-2">
|
||||
<LogoIcon className="h-8" />
|
||||
</span>
|
||||
<span>{SITE_NAME}</span>
|
||||
</a>
|
||||
</div>
|
||||
{menu.length ? (
|
||||
<nav className="col-span-1 lg:col-span-7">
|
||||
<ul className="grid md:grid-flow-col md:grid-cols-3 md:grid-rows-4">
|
||||
{menu.map((item: Menu) => (
|
||||
<li key={item.title} className="py-3 md:py-0 md:pb-4">
|
||||
<Link
|
||||
href={item.path}
|
||||
className="text-gray-800 transition duration-150 ease-in-out hover:text-gray-300 dark:text-gray-100"
|
||||
>
|
||||
{item.title}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
) : null}
|
||||
<div className="col-span-1 text-black dark:text-white lg:col-span-2">
|
||||
<a aria-label="Github Repository" href="https://github.com/vercel/commerce">
|
||||
<GitHubIcon className="h-6" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col items-center justify-between space-y-4 pb-10 pt-6 text-sm md:flex-row">
|
||||
<p>
|
||||
© {copyrightDate} {SITE_NAME}. All rights reserved.
|
||||
</p>
|
||||
<div className="flex items-center text-sm text-white dark:text-black">
|
||||
<span className="text-black dark:text-white">Created by</span>
|
||||
<a
|
||||
rel="noopener noreferrer"
|
||||
href="https://vercel.com"
|
||||
aria-label="Vercel.com Link"
|
||||
target="_blank"
|
||||
className="text-black dark:text-white"
|
||||
>
|
||||
<VercelIcon className="ml-3 inline-block h-6" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
31
components/layout/footer/footer.tsx
Normal file
31
components/layout/footer/footer.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
'use client'
|
||||
|
||||
import Logo from 'components/ui/logo/logo';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
interface FooterProps {}
|
||||
|
||||
const Footer = () => {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const copyrightDate = 2023 + (currentYear > 2023 ? `-${currentYear}` : '');
|
||||
const t = useTranslations('ui');
|
||||
|
||||
return (
|
||||
<footer className="border-t border-ui-border bg-app">
|
||||
<div className="mx-auto w-full py-2 px-4 lg:py-3 lg:px-8 2xl:px-16">
|
||||
<div className="flex w-full justify-between items-baseline my-12 transition-colors duration-150">
|
||||
<div className="">
|
||||
<a className="flex flex-initial items-center font-bold md:mr-24" href="/">
|
||||
<Logo />
|
||||
</a>
|
||||
</div>
|
||||
<p>
|
||||
© {copyrightDate} - {t('copyright')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
export default Footer;
|
2
components/layout/footer/index.ts
Normal file
2
components/layout/footer/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from './footer';
|
||||
|
8
components/layout/header/header-root.tsx
Normal file
8
components/layout/header/header-root.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { cn } from 'lib/utils'
|
||||
import { FC, ReactNode } from 'react'
|
||||
|
||||
const HeaderRoot: FC<{ children?: ReactNode }> = ({ children }) => {
|
||||
return <header className={cn('w-full bg-app')}>{children}</header>
|
||||
}
|
||||
|
||||
export default HeaderRoot
|
73
components/layout/header/header.tsx
Normal file
73
components/layout/header/header.tsx
Normal file
@@ -0,0 +1,73 @@
|
||||
'use client'
|
||||
|
||||
import Logo from 'components/ui/logo/logo'
|
||||
import {
|
||||
NavigationMenu,
|
||||
NavigationMenuItem,
|
||||
NavigationMenuLink,
|
||||
NavigationMenuList,
|
||||
navigationMenuTriggerStyle,
|
||||
} from 'components/ui/navigation-menu'
|
||||
import Link from 'next/link'
|
||||
import { FC } from 'react'
|
||||
import HeaderRoot from './header-root'
|
||||
|
||||
interface HeaderProps {}
|
||||
|
||||
const Header: FC<HeaderProps> = () => {
|
||||
|
||||
return (
|
||||
<HeaderRoot>
|
||||
<div className="relative flex flex-col">
|
||||
<div className="relative flex items-center w-full justify-between py-2 px-4 h-14 lg:h-16 lg:py-3 lg:px-8 2xl:px-16">
|
||||
|
||||
<div className="flex items-center">
|
||||
<Link
|
||||
href="/"
|
||||
className="cursor-pointer duration-100 ease-in-out absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 lg:relative lg:left-0 lg:top-0 lg:translate-x-0 lg:translate-y-0"
|
||||
aria-label="Logo"
|
||||
>
|
||||
<Logo />
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="absolute transform left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||
<NavigationMenu delayDuration={0} className="hidden lg:block">
|
||||
<NavigationMenuList>
|
||||
<NavigationMenuItem>
|
||||
<Link href={'/kategori/junior'} legacyBehavior passHref>
|
||||
<NavigationMenuLink
|
||||
className={navigationMenuTriggerStyle()}
|
||||
>
|
||||
Junior
|
||||
</NavigationMenuLink>
|
||||
</Link>
|
||||
</NavigationMenuItem>
|
||||
<NavigationMenuItem>
|
||||
<Link href={'/kategori/trojor'} legacyBehavior passHref>
|
||||
<NavigationMenuLink
|
||||
className={navigationMenuTriggerStyle()}
|
||||
>
|
||||
Tröjor
|
||||
</NavigationMenuLink>
|
||||
</Link>
|
||||
</NavigationMenuItem>
|
||||
<NavigationMenuItem>
|
||||
<Link href={'/kategori/byxor'} legacyBehavior passHref>
|
||||
<NavigationMenuLink
|
||||
className={navigationMenuTriggerStyle()}
|
||||
>
|
||||
Byxor
|
||||
</NavigationMenuLink>
|
||||
</Link>
|
||||
</NavigationMenuItem>
|
||||
</NavigationMenuList>
|
||||
</NavigationMenu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</HeaderRoot>
|
||||
)
|
||||
}
|
||||
|
||||
export default Header
|
2
components/layout/header/index.ts
Normal file
2
components/layout/header/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from './header';
|
||||
|
@@ -1,21 +1,18 @@
|
||||
import Link from 'next/link';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import Cart from 'components/cart';
|
||||
import CartIcon from 'components/icons/cart';
|
||||
import LogoIcon from 'components/icons/logo';
|
||||
import { getMenu } from 'lib/shopify';
|
||||
import { Menu } from 'lib/shopify/types';
|
||||
import MobileMenu from './mobile-menu';
|
||||
import Search from './search';
|
||||
// import { getMenu } from 'lib/shopify';
|
||||
// import { Menu } from 'lib/shopify/types';
|
||||
// import MobileMenu from './mobile-menu';
|
||||
// import Search from './search';
|
||||
|
||||
export default async function Navbar() {
|
||||
const menu = await getMenu('next-js-frontend-header-menu');
|
||||
// const menu = await getMenu('next-js-frontend-header-menu');
|
||||
|
||||
return (
|
||||
<nav className="relative flex items-center justify-between bg-white p-4 dark:bg-black lg:px-6">
|
||||
<div className="block w-1/3 md:hidden">
|
||||
<MobileMenu menu={menu} />
|
||||
{/* <MobileMenu menu={menu} /> */}
|
||||
</div>
|
||||
<div className="flex justify-self-center md:w-1/3 md:justify-self-start">
|
||||
<div className="md:mr-4">
|
||||
@@ -23,7 +20,7 @@ export default async function Navbar() {
|
||||
<LogoIcon className="h-8 transition-transform hover:scale-110" />
|
||||
</Link>
|
||||
</div>
|
||||
{menu.length ? (
|
||||
{/* {menu.length ? (
|
||||
<ul className="hidden md:flex">
|
||||
{menu.map((item: Menu) => (
|
||||
<li key={item.title}>
|
||||
@@ -36,17 +33,17 @@ export default async function Navbar() {
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
) : null} */}
|
||||
</div>
|
||||
<div className="hidden w-1/3 md:block">
|
||||
<Search />
|
||||
{/* <Search /> */}
|
||||
</div>
|
||||
|
||||
<div className="flex w-1/3 justify-end">
|
||||
<Suspense fallback={<CartIcon className="h-6" />}>
|
||||
{/* <Suspense fallback={<CartIcon className="h-6" />}> */}
|
||||
{/* @ts-expect-error Server Component */}
|
||||
<Cart />
|
||||
</Suspense>
|
||||
{/* <Cart /> */}
|
||||
{/* </Suspense> */}
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
|
30
components/ui/locale-switcher.tsx
Normal file
30
components/ui/locale-switcher.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import { usePathname } from 'next/navigation'
|
||||
import { i18n } from '../../i18n-config'
|
||||
|
||||
export default function LocaleSwitcher() {
|
||||
const pathName = usePathname()
|
||||
const redirectedPathName = (locale: string) => {
|
||||
if (!pathName) return '/'
|
||||
const segments = pathName.split('/')
|
||||
segments[1] = locale
|
||||
return segments.join('/')
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p>Locale switcher:</p>
|
||||
<ul>
|
||||
{i18n.locales.map((locale) => {
|
||||
return (
|
||||
<li key={locale}>
|
||||
<Link href={redirectedPathName(locale)}>{locale}</Link>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
2
components/ui/logo/index.ts
Normal file
2
components/ui/logo/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from './logo';
|
||||
|
21
components/ui/logo/logo.tsx
Normal file
21
components/ui/logo/logo.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
const Logo = ({ className = 'w-auto h-8', ...props }) => (
|
||||
<div className="flex items-center space-x-4">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 109 80"
|
||||
className={className}
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M54.6,0C32.8,0,15.1,17.9,15.1,40c0,10.6,4.3,18.1,4.6,18.8h20.6c-0.7-0.5-9.1-6.9-9.1-18.8 c0-13.1,10.5-23.7,23.4-23.7S78,26.9,78,40S67.5,63.7,54.6,63.7H0V80h54.6c21.8,0,39.5-17.9,39.5-40S76.5,0,54.6,0z"
|
||||
/>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M109,63.7V80H75.3c7.2-3.7,13.2-9.4,17.4-16.3H109z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
)
|
||||
|
||||
export default Logo
|
2
components/ui/navigation-menu/index.ts
Normal file
2
components/ui/navigation-menu/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './navigation-menu';
|
||||
|
123
components/ui/navigation-menu/navigation-menu.tsx
Normal file
123
components/ui/navigation-menu/navigation-menu.tsx
Normal file
@@ -0,0 +1,123 @@
|
||||
'use client'
|
||||
|
||||
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'
|
||||
import { cva } from 'class-variance-authority'
|
||||
import { ChevronDown } from 'lucide-react'
|
||||
import * as React from 'react'
|
||||
|
||||
import { cn } from 'lib/utils'
|
||||
|
||||
const NavigationMenu = React.forwardRef<
|
||||
React.ElementRef<typeof NavigationMenuPrimitive.Root>,
|
||||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
|
||||
>(({ className, children, ...props }, ref) => (
|
||||
<NavigationMenuPrimitive.Root
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'relative flex flex-1 items-center justify-center',
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<NavigationMenuViewport />
|
||||
</NavigationMenuPrimitive.Root>
|
||||
))
|
||||
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName
|
||||
|
||||
const NavigationMenuList = React.forwardRef<
|
||||
React.ElementRef<typeof NavigationMenuPrimitive.List>,
|
||||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<NavigationMenuPrimitive.List
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'group flex flex-1 list-none items-center justify-center',
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
|
||||
|
||||
const NavigationMenuItem = NavigationMenuPrimitive.Item
|
||||
|
||||
const navigationMenuTriggerStyle = cva(
|
||||
'inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:bg-subtle disabled:opacity-50 disabled:pointer-events-none hover:bg-ui-hover data-[state=open]:bg-ui-hover data-[active]:bg-ui-active h-10 py-1 px-3 group w-max'
|
||||
)
|
||||
|
||||
const NavigationMenuTrigger = React.forwardRef<
|
||||
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
|
||||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
|
||||
>(({ className, children, ...props }, ref) => (
|
||||
<NavigationMenuPrimitive.Trigger
|
||||
ref={ref}
|
||||
className={cn(navigationMenuTriggerStyle(), 'group', className)}
|
||||
{...props}
|
||||
>
|
||||
{children}{' '}
|
||||
<ChevronDown
|
||||
className="relative top-[1px] ml-2 h-5 w-5 transition duration-200 group-data-[state=open]:rotate-180"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</NavigationMenuPrimitive.Trigger>
|
||||
))
|
||||
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName
|
||||
|
||||
const NavigationMenuContent = React.forwardRef<
|
||||
React.ElementRef<typeof NavigationMenuPrimitive.Content>,
|
||||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<NavigationMenuPrimitive.Content
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=to-start]:slide-out-to-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=from-end]:slide-in-from-right-52 top-0 left-0 w-full md:absolute md:w-auto',
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName
|
||||
|
||||
const NavigationMenuLink = NavigationMenuPrimitive.Link
|
||||
|
||||
const NavigationMenuViewport = React.forwardRef<
|
||||
React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
|
||||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<div className={cn('absolute left-0 top-full flex justify-center z-50')}>
|
||||
<NavigationMenuPrimitive.Viewport
|
||||
className={cn(
|
||||
'origin-top-center data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:zoom-in-90 data-[state=closed]:zoom-out-95 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden drop-shadow bg-white md:w-[var(--radix-navigation-menu-viewport-width)]',
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
{...props}
|
||||
/>
|
||||
</div>
|
||||
))
|
||||
NavigationMenuViewport.displayName =
|
||||
NavigationMenuPrimitive.Viewport.displayName
|
||||
|
||||
const NavigationMenuIndicator = React.forwardRef<
|
||||
React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
|
||||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<NavigationMenuPrimitive.Indicator
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=visible]:fade-in data-[state=hidden]:fade-out top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<div className="relative top-[60%] h-2 w-2 rotate-45 bg-ui" />
|
||||
</NavigationMenuPrimitive.Indicator>
|
||||
))
|
||||
NavigationMenuIndicator.displayName =
|
||||
NavigationMenuPrimitive.Indicator.displayName
|
||||
|
||||
export {
|
||||
NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, navigationMenuTriggerStyle
|
||||
}
|
||||
|
Reference in New Issue
Block a user