add: simple transition effect to layouts
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import ClientSideWrapper from '@/components/wrapper/ClientSideWrapper';
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
function DialogsLayout({ children }: { children: React.ReactNode }) {
|
function DialogsLayout({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<main className='h-full w-full bg-container lg:bg-background pt-4 pb-6 px-6'>
|
<ClientSideWrapper>
|
||||||
{children}
|
<main className='h-full w-full bg-container lg:bg-background pt-4 pb-6 px-6'>
|
||||||
</main>
|
{children}
|
||||||
|
</main>
|
||||||
|
</ClientSideWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,15 @@ export const metadata = {
|
|||||||
|
|
||||||
export default function MenuLayout({
|
export default function MenuLayout({
|
||||||
children,
|
children,
|
||||||
report
|
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
report: React.ReactNode,
|
|
||||||
}>) {
|
}>) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ClientSideWrapper>
|
<ClientMenuRouteWrapper>
|
||||||
<ClientMenuRouteWrapper>
|
<ClientSideWrapper>
|
||||||
{children}
|
{children}
|
||||||
{report}
|
</ClientSideWrapper>
|
||||||
</ClientMenuRouteWrapper>
|
</ClientMenuRouteWrapper>
|
||||||
</ClientSideWrapper>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import ClientSideWrapper from '@/components/wrapper/ClientSideWrapper';
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
function DialogsLayout({ children }: { children: React.ReactNode }) {
|
function DialogsLayout({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<main className='h-full w-full bg-background pt-4 pb-6 px-6'>
|
<ClientSideWrapper>
|
||||||
{children}
|
<main className='h-full w-full bg-background pt-4 pb-6 px-6'>
|
||||||
</main>
|
{children}
|
||||||
|
</main>
|
||||||
|
</ClientSideWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,30 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import { AnimatePresence, motion } from 'framer-motion'
|
||||||
|
import { usePathname } from 'next/navigation'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
type Props = { } & React.AllHTMLAttributes<HTMLBodyElementEventMap>
|
type Props = {
|
||||||
|
children: React.ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
function ClientSideWrapper({ children }: Props) {
|
function ClientSideWrapper({ children }: Props) {
|
||||||
|
const pathname = usePathname()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<AnimatePresence mode="wait">
|
||||||
|
<motion.div
|
||||||
|
key={pathname}
|
||||||
|
initial={{ opacity: 0, y: -10, }}
|
||||||
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
exit={{ opacity: 0, y: 0, transition: { duration: 0 } }}
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
className="h-full"
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</>
|
</motion.div>
|
||||||
|
</AnimatePresence>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ClientSideWrapper
|
export default ClientSideWrapper
|
||||||
|
|||||||
Reference in New Issue
Block a user