feat: animations
This commit is contained in:
1 parent
e4788ae384
commit
7b55619cf5
16 files changed
+643
-320
No files matched your search
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useAtom } from 'jotai';
|
||||
import { atomWithStorage } from 'jotai/utils';
|
||||
import { ArrowLeft, ArrowRight, SlidersHorizontal } from 'lucide-react';
|
||||
@@ -15,12 +16,21 @@ const isShowFilterAtom = atomWithStorage('is-show-filters', false);
|
||||
export default function Container() {
|
||||
const [isShowFilter, setIsShowFilter] = useAtom(isShowFilterAtom);
|
||||
const { movie, next, previous, hasPrevious } = useRandomMovie();
|
||||
const [direction, setDirection] = useState(0);
|
||||
|
||||
return (
|
||||
<>
|
||||
{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'>
|
||||
<Button className='p-2' onClick={previous} disabled={!hasPrevious} title='Previous movie'>
|
||||
<Button
|
||||
className='p-2'
|
||||
onClick={() => {
|
||||
previous();
|
||||
setDirection(-1);
|
||||
}}
|
||||
disabled={!hasPrevious}
|
||||
title='Previous movie'
|
||||
>
|
||||
<ArrowLeft size={24} strokeWidth={1} />
|
||||
</Button>
|
||||
<Button
|
||||
@@ -31,11 +41,19 @@ export default function Container() {
|
||||
>
|
||||
<SlidersHorizontal size={24} strokeWidth={1} />
|
||||
</Button>
|
||||
<Button className='w-full p-2 grow' onClick={next} title='Next movie'>
|
||||
<Button
|
||||
className='w-full p-2 grow'
|
||||
variant='default'
|
||||
onClick={() => {
|
||||
next();
|
||||
setDirection(1);
|
||||
}}
|
||||
title='Next movie'
|
||||
>
|
||||
<ArrowRight size={24} strokeWidth={1} />
|
||||
</Button>
|
||||
</div>
|
||||
<Movie key={movie?.id} movie={movie} />
|
||||
<Movie movie={movie} direction={direction} />
|
||||
<div className='w-full h-2 max-sm:h-20' />
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user