fix: mobile menu
This commit is contained in:
1 parent
84a631b56a
commit
cd8928ab54
6 files changed
+54
-23
No files matched your search
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { Menu } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
@@ -31,11 +32,12 @@ interface Props {
|
||||
}
|
||||
|
||||
export function NavigationSmall({ className }: Props) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const currentPath = usePathname();
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<DropdownMenu>
|
||||
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant='ghost' size='icon'>
|
||||
<Menu size={19} />
|
||||
@@ -45,7 +47,9 @@ export function NavigationSmall({ className }: Props) {
|
||||
<DropdownMenuRadioGroup value={currentPath}>
|
||||
{paths.map(({ path, title }) => (
|
||||
<Link href={path} legacyBehavior shallow key={path}>
|
||||
<DropdownMenuRadioItem value={path}>{title}</DropdownMenuRadioItem>
|
||||
<DropdownMenuRadioItem value={path} onClick={() => setIsOpen(false)}>
|
||||
{title}
|
||||
</DropdownMenuRadioItem>
|
||||
</Link>
|
||||
))}
|
||||
</DropdownMenuRadioGroup>
|
||||
|
||||
@@ -18,6 +18,7 @@ const Header: FC = () => (
|
||||
<div className='flex items-center gap-2'>
|
||||
<ToggleTheme />
|
||||
<ToggleSearch />
|
||||
<div id='actions' className='empty:hidden' />
|
||||
<NavigationSmall className='flex sm:hidden' />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,13 +17,13 @@ export default function Actions({ onClose, movie }: Props) {
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
className='h-8 grow'
|
||||
className='h-8 flex-grow w-[50%]'
|
||||
onClick={() => showTorrentsModal({ title: movie.title, year: new Date(movie.release_date).getFullYear() })}
|
||||
>
|
||||
Torrents
|
||||
</Button>
|
||||
<Button
|
||||
className='h-8 grow'
|
||||
className='h-8 flex-grow w-[50%]'
|
||||
onClick={() => {
|
||||
router.push(`/similar?movieId=${movie.id}&title=${encodeURIComponent(movie.title)}`);
|
||||
onClose?.();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { FC } from 'react';
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
|
||||
import Credits from '@/components/Movie/components/Credits';
|
||||
@@ -17,6 +17,7 @@ interface Props {
|
||||
className?: string;
|
||||
direction?: number;
|
||||
onClose?: () => void;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
const variants = {
|
||||
@@ -29,7 +30,7 @@ const variants = {
|
||||
exit: (direction: number) => ({ scale: 0.8, opacity: 1, x: direction * -300 })
|
||||
};
|
||||
|
||||
const Preview: FC<Props> = ({ movie, className, direction, onClose }) => {
|
||||
const Preview: FC<Props> = ({ movie, className, direction, onClose, children }) => {
|
||||
if (!movie) return null;
|
||||
|
||||
return (
|
||||
@@ -54,6 +55,7 @@ const Preview: FC<Props> = ({ movie, className, direction, onClose }) => {
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
<div className='flex flex-col grow'>
|
||||
{children && <div className='flex w-full mb-2 gap-2'>{children}</div>}
|
||||
<div className='flex w-full gap-2'>
|
||||
<Actions movie={movie} onClose={onClose} />
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user