InvestWeb/layouts/DashLayout.tsx

77 lines
2.2 KiB
TypeScript
Raw Normal View History

2022-12-13 07:00:49 -05:00
import {
AnimatePresence,
domAnimation,
LazyMotion,
m,
Variants,
} from "framer-motion";
import Head from "next/head";
import { useRouter } from "next/router";
import NavBar from "../components/dashboard/NavBar";
interface DashLayoutProps {
children: React.ReactNode;
}
function DashLayout(props: DashLayoutProps) {
// get the current route for animation purposes
const router = useRouter();
return (
<m.div
2022-12-31 05:22:27 -05:00
className="bg-gradient-to-t from-zinc-900 to-[#3015457b]"
initial="initial"
animate="animate"
exit="exit"
variants={containerVariants}
>
2022-12-13 07:00:49 -05:00
<Head>
2023-01-20 21:24:31 -05:00
<meta name="viewport" content="initial-scale=0.8" />
2022-12-31 05:22:27 -05:00
<title>Dashboard - toffee</title>
<meta name="description" content="Dashboard statistics for toffee" />
2022-12-13 07:00:49 -05:00
<link rel="icon" href="/favicon.ico" />
<meta name="theme-color" content="#c084fc" />
2022-12-31 05:22:27 -05:00
<meta property="og:title" content="toffee" />
2022-12-13 07:00:49 -05:00
<meta
property="og:description"
content="Serving anny's community est. 2022"
/>
<meta property="og:image" content="/img/logo.webp" />
<meta property="og:type" content="website" />
2022-12-31 05:22:27 -05:00
<meta property="og:site_name" content="toffee" />
2022-12-13 07:00:49 -05:00
</Head>
2022-12-20 09:38:26 -05:00
<div className="flex h-screen w-screen flex-col overflow-hidden lg:flex-row">
2022-12-13 07:00:49 -05:00
{/* dashboard nav bar */}
<LazyMotion features={domAnimation}>
<AnimatePresence mode="wait">
<NavBar />
</AnimatePresence>
</LazyMotion>
{/* dashboard content */}
<LazyMotion features={domAnimation}>
<AnimatePresence mode="wait">
<m.div
key={router.route.concat("layout-fade")}
2022-12-20 09:38:26 -05:00
className="w-screen overflow-y-scroll"
2022-12-13 07:00:49 -05:00
variants={containerVariants}
initial="initial"
animate="animate"
exit="exit"
>
{props.children}
</m.div>
</AnimatePresence>
</LazyMotion>
</div>
</m.div>
2022-12-13 07:00:49 -05:00
);
}
const containerVariants: Variants = {
initial: { opacity: 0 },
animate: { opacity: 1 },
exit: { opacity: 0 },
};
export default DashLayout;