fix: header

This commit is contained in:
ner committed 2024-03-22 13:41:31 +02:00
1 parent 095f7361fa
commit 1a762d00c5
13 files changed
+432 -105

No files matched your search

+3 -3
View File
@@ -34,8 +34,8 @@ export default function Container() {
return ( return (
<> <>
{isShowFilter && <Filter />} {isShowFilter && <Filter />}
<div className='gap-2 flex bg-background mb-2 lg:static max-sm:z-10 max-sm:fixed max-sm:bottom-0 max-sm:left-0 max-sm:w-full max-sm:p-2 max-sm:px-[12px] max-sm:mb-0'> <div className='gap-2 flex bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 mb-2 lg:static max-sm:z-10 max-sm:fixed max-sm:bottom-0 max-sm:left-0 max-sm:w-full max-sm:p-2 max-sm:px-2 max-sm:mb-0'>
<Button className='p-2' onClick={handleChangeMovie(-1)} disabled={!hasPrevious} title='Previous movie'> <Button className='p-2 grow' onClick={handleChangeMovie(-1)} disabled={!hasPrevious} title='Previous movie'>
<ArrowLeft size={24} strokeWidth={1} /> <ArrowLeft size={24} strokeWidth={1} />
</Button> </Button>
<Button <Button
@@ -46,7 +46,7 @@ export default function Container() {
> >
<SlidersHorizontal size={24} strokeWidth={1} /> <SlidersHorizontal size={24} strokeWidth={1} />
</Button> </Button>
<Button className='w-full p-2 grow' onClick={handleChangeMovie(1)} title='Next movie'> <Button className='p-2 grow' onClick={handleChangeMovie(1)} title='Next movie'>
<ArrowRight size={24} strokeWidth={1} /> <ArrowRight size={24} strokeWidth={1} />
</Button> </Button>
</div> </div>
+10 -3
View File
@@ -1,6 +1,6 @@
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import type { Metadata } from 'next'; import type { Metadata, Viewport } from 'next';
import { cookies } from 'next/headers'; import { cookies } from 'next/headers';
import Header from '@/components/Header'; import Header from '@/components/Header';
@@ -13,19 +13,26 @@ export const metadata: Metadata = {
description: 'It is going to help you find a movie for evening' description: 'It is going to help you find a movie for evening'
}; };
export const viewport: Viewport = {
themeColor: 'black',
width: 'device-width',
initialScale: 1,
maximumScale: 1,
userScalable: false
};
export default function RootLayout({ children }: { children: ReactNode }) { export default function RootLayout({ children }: { children: ReactNode }) {
const theme = cookies().get('theme')?.value as Theme; const theme = cookies().get('theme')?.value as Theme;
return ( return (
<html lang='en' className={theme}> <html lang='en' className={theme}>
<head> <head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' />
<meta name='theme-color' content='black' /> <meta name='theme-color' content='black' />
</head> </head>
<body> <body>
<Providers theme={theme}> <Providers theme={theme}>
<Header /> <Header />
<main>{children}</main> <main className='px-2 max-w-[1260px] mx-auto'>{children}</main>
<ReactQueryDevtools initialIsOpen={false} /> <ReactQueryDevtools initialIsOpen={false} />
</Providers> </Providers>
</body> </body>
@@ -1,29 +1,76 @@
'use client'; 'use client';
import { Menu } from 'lucide-react';
import Link from 'next/link'; import Link from 'next/link';
import { usePathname } from 'next/navigation'; 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 paths = [
const path = usePathname(); { 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 ( return (
<Tabs value={path} className='flex-grow'> <div className={className}>
<TabsList className='flex w-full'> <DropdownMenu>
{[ <DropdownMenuTrigger asChild>
{ path: '/', title: 'Random' }, <Button variant='ghost' size='icon'>
{ path: '/popular', title: 'Popular' }, <Menu size={19} />
{ path: '/top', title: 'Top rated' }, </Button>
{ path: '/favorites', title: 'Favorites' } </DropdownMenuTrigger>
].map(({ path, title }) => ( <DropdownMenuContent>
<Link href={path} className='w-full' key={path} shallow> <DropdownMenuRadioGroup value={currentPath}>
<TabsTrigger className='w-full' value={path}> {paths.map(({ path, title }) => (
{title} <Link href={path} legacyBehavior shallow key={path}>
</TabsTrigger> <DropdownMenuRadioItem value={path}>{title}</DropdownMenuRadioItem>
</Link> </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> </NavigationMenuList>
</Tabs> </NavigationMenu>
); );
} }
@@ -76,8 +76,8 @@ export const showSearchModal = create(Search);
export default function ToggleSearch() { export default function ToggleSearch() {
return ( return (
<Button variant='outline' size='icon' onClick={() => showSearchModal()}> <Button variant='ghost' size='icon' onClick={() => showSearchModal()}>
<SearchIcon /> <SearchIcon size={19} />
</Button> </Button>
); );
} }
@@ -8,8 +8,8 @@ import { useTheme } from '@/hooks/useTheme';
export default function ThemeToggle() { export default function ThemeToggle() {
const [theme, setTheme] = useTheme(); const [theme, setTheme] = useTheme();
return ( return (
<Button variant='outline' size='icon' onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}> <Button variant='ghost' size='icon' onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}>
{theme === 'light' ? <Moon /> : <Sun />} {theme === 'light' ? <Moon size={19} /> : <Sun size={19} />}
</Button> </Button>
); );
} }
+7 -8
View File
@@ -3,23 +3,22 @@ import Link from 'next/link';
import { Badge } from '@/components/ui/badge'; import { Badge } from '@/components/ui/badge';
import Navigation from './components/Navigation'; import Navigation, { NavigationSmall } from './components/Navigation';
import ToggleSearch from './components/Search'; import ToggleSearch from './components/Search';
import ToggleTheme from './components/ThemeToggle'; import ToggleTheme from './components/ThemeToggle';
const Header: FC = () => ( const Header: FC = () => (
<header className='flex justify-center bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 sticky pt-2 pb-2 top-0 z-10'> <header className='flex justify-center bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 sticky py-2 top-0 z-10'>
<div className='max-w-[1260px] w-full px-[12px]'> <div className='max-w-[1260px] w-full px-2'>
<div className='flex items-center justify-between gap-2 flex-wrap md:flex-nowrap'> <div className='flex items-center justify-between gap-2 md:flex-nowrap'>
<Link href='/' shallow> <Link href='/' shallow legacyBehavior>
<Badge className='whitespace-nowrap'>Movie advisor</Badge> <Badge className='whitespace-nowrap'>Movie advisor</Badge>
</Link> </Link>
<div className='w-full order-3 md:order-none'> <Navigation className='hidden sm:flex' />
<Navigation />
</div>
<div className='flex items-center gap-2'> <div className='flex items-center gap-2'>
<ToggleTheme /> <ToggleTheme />
<ToggleSearch /> <ToggleSearch />
<NavigationSmall className='flex sm:hidden' />
</div> </div>
</div> </div>
</div> </div>
+1 -1
View File
@@ -34,7 +34,7 @@ const Preview: FC<Props> = ({ movie, className, direction, onClose }) => {
return ( return (
<div className={cn('rounded-xl text-card-foreground', { 'p-2': Boolean(onClose) }, className)}> <div className={cn('rounded-xl text-card-foreground', { 'p-2': Boolean(onClose) }, className)}>
<div className='flex flex-col lg:flex-row max-w-[100%] gap-3'> <div className='flex flex-col lg:flex-row max-w-[100%] gap-2'>
<div className='max-w-[300px] min-w-[300px] h-[450px] mx-auto w-[100%] relative overflow-hidden rounded-lg'> <div className='max-w-[300px] min-w-[300px] h-[450px] mx-auto w-[100%] relative overflow-hidden rounded-lg'>
<AnimatePresence custom={direction}> <AnimatePresence custom={direction}>
<motion.div <motion.div
@@ -36,7 +36,7 @@ const Credits: FC<Props> = ({ movieId, onPersonClick }) => {
return ( return (
Boolean(credits?.length) && ( Boolean(credits?.length) && (
<div className='overflow-auto max-w-[100%] py-3 mb-[-0.75rem]'> <div className='overflow-auto no-scrollbar max-w-[100%] py-2 pb-5 mb-[-0.75rem]'>
<motion.ul className='flex gap-3' variants={container} initial='hidden' animate='visible' whileInView='visible'> <motion.ul className='flex gap-3' variants={container} initial='hidden' animate='visible' whileInView='visible'>
{credits?.map((actor) => ( {credits?.map((actor) => (
<motion.li <motion.li
+11 -6
View File
@@ -67,7 +67,7 @@ const showHostManagerModal = create(({ onResolve, isOpen }) => {
}); });
const Torrents: FC<Props> = ({ title, year, isOpen, onResolve }) => { const Torrents: FC<Props> = ({ title, year, isOpen, onResolve }) => {
const host = useAtomValue(hostAtom); const hosts = useAtomValue(hostAtom);
const [sorting, setSorting] = useState<Sorting>({ by: ORDER.seeders }); const [sorting, setSorting] = useState<Sorting>({ by: ORDER.seeders });
const [withYear, setWithYear] = useState(true); const [withYear, setWithYear] = useState(true);
@@ -80,8 +80,10 @@ const Torrents: FC<Props> = ({ title, year, isOpen, onResolve }) => {
const handleCast = (magnet: string) => (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => { const handleCast = (magnet: string) => (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
event.preventDefault(); event.preventDefault();
const link = window.open(`http://${host}:65220/playuri?uri=${magnet}`, '_blank'); hosts.split(',').forEach((host) => {
setTimeout(() => link?.close(), 100); const link = window.open(`http://${host}:65220/playuri?uri=${magnet}`, '_blank');
setTimeout(() => link?.close(), 100);
});
}; };
return ( return (
@@ -89,8 +91,8 @@ const Torrents: FC<Props> = ({ title, year, isOpen, onResolve }) => {
<Table className='rounded-xl overflow-hidden'> <Table className='rounded-xl overflow-hidden'>
<TableHeader> <TableHeader>
<TableRow> <TableRow>
<TableHead className='px-2'> <TableHead className='px-2' colSpan={4}>
Title: {title}{' '} {title}{' '}
<Toggle <Toggle
size='sm' size='sm'
className='p-2 h-7' className='p-2 h-7'
@@ -100,6 +102,9 @@ const Torrents: FC<Props> = ({ title, year, isOpen, onResolve }) => {
{year} {year}
</Toggle> </Toggle>
</TableHead> </TableHead>
</TableRow>
<TableRow>
<TableHead className='px-2'>Title</TableHead>
<TableHeadSortable title='Size' by={ORDER.size} value={sorting} onChange={setSorting} /> <TableHeadSortable title='Size' by={ORDER.size} value={sorting} onChange={setSorting} />
<TableHeadSortable title='Seeders' by={ORDER.seeders} value={sorting} onChange={setSorting} /> <TableHeadSortable title='Seeders' by={ORDER.seeders} value={sorting} onChange={setSorting} />
<TableHead className='px-2 text-center cursor-pointer select-none' onClick={() => showHostManagerModal()}> <TableHead className='px-2 text-center cursor-pointer select-none' onClick={() => showHostManagerModal()}>
@@ -117,7 +122,7 @@ const Torrents: FC<Props> = ({ title, year, isOpen, onResolve }) => {
<TableCell className='text-center p-2'>{torrent.seeders}</TableCell> <TableCell className='text-center p-2'>{torrent.seeders}</TableCell>
<TableCell className='text-center p-1'> <TableCell className='text-center p-1'>
<div className='flex gap-2 m-auto justify-center'> <div className='flex gap-2 m-auto justify-center'>
{host ? ( {hosts ? (
<a <a
onClick={handleCast(torrent.magnet!)} onClick={handleCast(torrent.magnet!)}
className='flex items-center justify-center h-8 w-8 border rounded-lg' className='flex items-center justify-center h-8 w-8 border rounded-lg'
+200
View File
@@ -0,0 +1,200 @@
"use client"
import * as React from "react"
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
import { Check, ChevronRight, Circle } from "lucide-react"
import { cn } from "@/lib/utils"
const DropdownMenu = DropdownMenuPrimitive.Root
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
const DropdownMenuGroup = DropdownMenuPrimitive.Group
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
const DropdownMenuSub = DropdownMenuPrimitive.Sub
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
const DropdownMenuSubTrigger = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
inset?: boolean
}
>(({ className, inset, children, ...props }, ref) => (
<DropdownMenuPrimitive.SubTrigger
ref={ref}
className={cn(
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
inset && "pl-8",
className
)}
{...props}
>
{children}
<ChevronRight className="ml-auto h-4 w-4" />
</DropdownMenuPrimitive.SubTrigger>
))
DropdownMenuSubTrigger.displayName =
DropdownMenuPrimitive.SubTrigger.displayName
const DropdownMenuSubContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.SubContent
ref={ref}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)}
{...props}
/>
))
DropdownMenuSubContent.displayName =
DropdownMenuPrimitive.SubContent.displayName
const DropdownMenuContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<DropdownMenuPrimitive.Portal>
<DropdownMenuPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)}
{...props}
/>
</DropdownMenuPrimitive.Portal>
))
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
const DropdownMenuItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean
}
>(({ className, inset, ...props }, ref) => (
<DropdownMenuPrimitive.Item
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
inset && "pl-8",
className
)}
{...props}
/>
))
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
const DropdownMenuCheckboxItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
>(({ className, children, checked, ...props }, ref) => (
<DropdownMenuPrimitive.CheckboxItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
checked={checked}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
</DropdownMenuPrimitive.CheckboxItem>
))
DropdownMenuCheckboxItem.displayName =
DropdownMenuPrimitive.CheckboxItem.displayName
const DropdownMenuRadioItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
>(({ className, children, ...props }, ref) => (
<DropdownMenuPrimitive.RadioItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<Circle className="h-2 w-2 fill-current" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
</DropdownMenuPrimitive.RadioItem>
))
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
const DropdownMenuLabel = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
inset?: boolean
}
>(({ className, inset, ...props }, ref) => (
<DropdownMenuPrimitive.Label
ref={ref}
className={cn(
"px-2 py-1.5 text-sm font-semibold",
inset && "pl-8",
className
)}
{...props}
/>
))
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
const DropdownMenuSeparator = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.Separator
ref={ref}
className={cn("-mx-1 my-1 h-px bg-muted", className)}
{...props}
/>
))
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
const DropdownMenuShortcut = ({
className,
...props
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
{...props}
/>
)
}
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
export {
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuCheckboxItem,
DropdownMenuRadioItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuGroup,
DropdownMenuPortal,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuRadioGroup,
}
+120
View File
@@ -0,0 +1,120 @@
import * as React from 'react';
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
import { cva } from 'class-variance-authority';
import { ChevronDown } from 'lucide-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 z-10 flex max-w-max 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 space-x-1', className)}
{...props}
/>
));
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
const NavigationMenuItem = NavigationMenuPrimitive.Item;
const navigationMenuTriggerStyle = cva(
'group inline-flex h-10 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/90 data-[state=open]:bg-accent/50'
);
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-1 h-3 w-3 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(
'left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 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')}>
<NavigationMenuPrimitive.Viewport
className={cn(
'origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 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(
'top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in',
className
)}
{...props}
>
<div className='relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md' />
</NavigationMenuPrimitive.Indicator>
));
NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName;
export {
NavigationMenu,
NavigationMenuContent,
NavigationMenuIndicator,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
navigationMenuTriggerStyle,
NavigationMenuViewport
};
-55
View File
@@ -1,55 +0,0 @@
'use client'
import * as React from 'react'
import * as TabsPrimitive from '@radix-ui/react-tabs'
import { cn } from '@/lib/utils'
const Tabs = TabsPrimitive.Root
const TabsList = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.List>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
>(({ className, ...props }, ref) => (
<TabsPrimitive.List
ref={ref}
className={cn(
'inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground',
className
)}
{...props}
/>
))
TabsList.displayName = TabsPrimitive.List.displayName
const TabsTrigger = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Trigger
ref={ref}
className={cn(
'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',
className
)}
{...props}
/>
))
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
const TabsContent = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Content
ref={ref}
className={cn(
'mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
className
)}
{...props}
/>
))
TabsContent.displayName = TabsPrimitive.Content.displayName
export { Tabs, TabsContent,TabsList, TabsTrigger }
+10 -6
View File
@@ -2,6 +2,16 @@
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
@layer utilities {
.no-scrollbar::-webkit-scrollbar {
display: none;
}
.no-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
}
@layer base { @layer base {
:root { :root {
--background: 0 0% 100%; --background: 0 0% 100%;
@@ -89,9 +99,3 @@
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
main {
max-width: 1260px;
margin: 0 auto;
padding: 0 12px;
}