feat: new nav
This commit is contained in:
1 parent
5733bc0af0
commit
750d5b12c8
25 files changed
+386
-325
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
import { Menu } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { usePathname, useRouter } from 'next/navigation';
|
||||
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -41,13 +41,15 @@ export function MobileNavigation() {
|
||||
<ul className='flex flex-col gap-2 p-2'>
|
||||
{paths.map(({ path, title }) => (
|
||||
<li key={path}>
|
||||
<DrawerClose asChild>
|
||||
<Button className='w-full relative' variant={currentPath === path ? 'default' : 'outline'}>
|
||||
<Link href={path} className='absolute flex items-center justify-center w-full h-full top-0 left-0'>
|
||||
{title}
|
||||
</Link>
|
||||
</Button>
|
||||
</DrawerClose>
|
||||
<Link href={path} shallow>
|
||||
<div>
|
||||
<DrawerClose asChild>
|
||||
<Button className='w-full relative' variant={currentPath === path ? 'default' : 'outline'}>
|
||||
{title}
|
||||
</Button>
|
||||
</DrawerClose>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { ChangeEvent, useRef, useState } from 'react';
|
||||
import { ChangeEvent, MutableRefObject, useRef, useState } from 'react';
|
||||
import { create } from 'react-modal-promise';
|
||||
import { Search as SearchIcon, XCircle } from 'lucide-react';
|
||||
|
||||
@@ -16,6 +16,7 @@ import useSearch from './useSearch';
|
||||
export const showSearchModal = create(({ onResolve }) => {
|
||||
const [title, setTitle] = useState('');
|
||||
const [query, setQuery] = useState('');
|
||||
const scrollRef = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;
|
||||
const timeout = useRef<NodeJS.Timeout>();
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
@@ -24,6 +25,7 @@ export const showSearchModal = create(({ onResolve }) => {
|
||||
hasNextPage: hasNextMoviesPage,
|
||||
fetchNextPage: fetchNextMoviesPage
|
||||
} = useSearch({ query, type: 'movie' });
|
||||
|
||||
const {
|
||||
data: series,
|
||||
hasNextPage: hasNextSeriesPage,
|
||||
@@ -49,7 +51,7 @@ export const showSearchModal = create(({ onResolve }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal className='block p-0 max-w-[940px]' onClose={handleClose}>
|
||||
<Modal className='block p-0 max-w-[932px]' onClose={handleClose} scrollRef={scrollRef}>
|
||||
<div className='relative p-2'>
|
||||
<Input
|
||||
autoFocus
|
||||
@@ -82,7 +84,7 @@ export const showSearchModal = create(({ onResolve }) => {
|
||||
<TabsContent value='movies'>
|
||||
{Boolean(movies?.pages.length && movies?.pages?.[0]?.results?.length) && (
|
||||
<List
|
||||
withBottomGap
|
||||
customScrollParent={scrollRef.current}
|
||||
pages={movies!.pages as unknown as MovieDBResponse[]}
|
||||
fetchNextPage={fetchNextMoviesPage}
|
||||
hasNextPage={hasNextMoviesPage}
|
||||
@@ -94,7 +96,7 @@ export const showSearchModal = create(({ onResolve }) => {
|
||||
<TabsContent value='series'>
|
||||
{Boolean(series?.pages.length && series?.pages?.[0]?.results?.length) && (
|
||||
<List
|
||||
withBottomGap
|
||||
customScrollParent={scrollRef.current}
|
||||
pages={series!.pages as unknown as MovieDBResponse[]}
|
||||
fetchNextPage={fetchNextSeriesPage}
|
||||
hasNextPage={hasNextSeriesPage}
|
||||
|
||||
@@ -9,7 +9,7 @@ import ToggleTheme from './components/ThemeToggle';
|
||||
|
||||
const Header: FC = () => (
|
||||
<header className='flex justify-center bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 py-2'>
|
||||
<div className='max-w-[1252px] w-full px-2'>
|
||||
<div className='max-w-[1240px] w-full px-2'>
|
||||
<div className='flex items-center justify-between gap-2 xs:flex-nowrap'>
|
||||
<Link href='/' shallow legacyBehavior>
|
||||
<Badge className='whitespace-nowrap cursor-pointer font-normal'>Movie advisor</Badge>
|
||||
|
||||
Reference in new issue
Block a user