fix: header
This commit is contained in:
1 parent
095f7361fa
commit
1a762d00c5
13 files changed
+432
-105
No files matched your search
@@ -1,29 +1,76 @@
|
||||
'use client';
|
||||
|
||||
import { Menu } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuRadioGroup,
|
||||
DropdownMenuRadioItem,
|
||||
DropdownMenuTrigger
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import {
|
||||
NavigationMenu,
|
||||
NavigationMenuItem,
|
||||
NavigationMenuLink,
|
||||
NavigationMenuList,
|
||||
navigationMenuTriggerStyle
|
||||
} from '@/components/ui/navigation-menu';
|
||||
|
||||
export default function Navigation() {
|
||||
const path = usePathname();
|
||||
const paths = [
|
||||
{ path: '/popular', title: 'Popular' },
|
||||
{ path: '/top', title: 'Top rated' },
|
||||
{ path: '/favorites', title: 'Favorites' }
|
||||
];
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function NavigationSmall({ className }: Props) {
|
||||
const currentPath = usePathname();
|
||||
|
||||
return (
|
||||
<Tabs value={path} className='flex-grow'>
|
||||
<TabsList className='flex w-full'>
|
||||
{[
|
||||
{ path: '/', title: 'Random' },
|
||||
{ path: '/popular', title: 'Popular' },
|
||||
{ path: '/top', title: 'Top rated' },
|
||||
{ path: '/favorites', title: 'Favorites' }
|
||||
].map(({ path, title }) => (
|
||||
<Link href={path} className='w-full' key={path} shallow>
|
||||
<TabsTrigger className='w-full' value={path}>
|
||||
{title}
|
||||
</TabsTrigger>
|
||||
</Link>
|
||||
<div className={className}>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant='ghost' size='icon'>
|
||||
<Menu size={19} />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
<DropdownMenuRadioGroup value={currentPath}>
|
||||
{paths.map(({ path, title }) => (
|
||||
<Link href={path} legacyBehavior shallow key={path}>
|
||||
<DropdownMenuRadioItem value={path}>{title}</DropdownMenuRadioItem>
|
||||
</Link>
|
||||
))}
|
||||
</DropdownMenuRadioGroup>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Navigation({ className }: Props) {
|
||||
const currentPath = usePathname();
|
||||
|
||||
return (
|
||||
<NavigationMenu className={className}>
|
||||
<NavigationMenuList>
|
||||
{paths.map(({ path, title }) => (
|
||||
<NavigationMenuItem key={path}>
|
||||
<Link href={path} shallow passHref legacyBehavior>
|
||||
<NavigationMenuLink active={path === currentPath} className={navigationMenuTriggerStyle()}>
|
||||
{title}
|
||||
</NavigationMenuLink>
|
||||
</Link>
|
||||
</NavigationMenuItem>
|
||||
))}
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
</NavigationMenuList>
|
||||
</NavigationMenu>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user