Skip to content

Commit

Permalink
feat(client): add animations for better user experience
Browse files Browse the repository at this point in the history
  • Loading branch information
lareii committed Sep 14, 2024
1 parent c84343b commit 6e3168a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
43 changes: 26 additions & 17 deletions client/app/app/layout-content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,31 @@ export default function LayoutContent({ children }) {
if (loading) return <Loading />;

return (
<div className='flex max-w-screen-lg mx-auto gap-x-5 max-lg:flex-col lg:pt-14 lg:px-5'>
<Navbar />
{/* css calc -> max-w-screen-lg - navbar width - gap and paddings */}
<div className='w-full lg:max-w-[calc(1024px-240px-(3*1.25rem))] max-lg:p-5 pb-5'>
<AnimatePresence mode='wait'>
<motion.div
key={isUsersPage ? pathname.split('/')[3] : pathname.split('/')[2]}
initial={{ y: 20, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ ease: 'easeInOut', duration: 0.3 }}
className='w-full'
>
{children}
</motion.div>
</AnimatePresence>
</div>
</div>
<AnimatePresence mode='wait'>
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ ease: 'easeInOut', duration: 0.3 }}
className='flex max-w-screen-lg mx-auto gap-x-5 max-lg:flex-col lg:pt-14 lg:px-5'
>
<Navbar />
{/* css calc -> max-w-screen-lg - navbar width - gap and paddings */}
<div className='w-full lg:max-w-[calc(1024px-240px-(3*1.25rem))] max-lg:p-5 pb-5'>
<AnimatePresence mode='wait'>
<motion.div
key={
isUsersPage ? pathname.split('/')[3] : pathname.split('/')[2]
}
initial={{ y: 20, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ ease: 'easeInOut', duration: 0.3 }}
className='w-full'
>
{children}
</motion.div>
</AnimatePresence>
</div>
</motion.div>
</AnimatePresence>
);
}
1 change: 0 additions & 1 deletion client/components/app/Loading/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default function Loading() {
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ ease: 'easeInOut', duration: 0.3 }}
className='h-screen flex flex-col items-center justify-center'
>
Expand Down

0 comments on commit 6e3168a

Please sign in to comment.