diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-22 11:03:34 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-22 11:03:34 +0700 |
| commit | f66b12fd1d0b83af0d7230d7b1565fbe00afbe3c (patch) | |
| tree | 253dcf854a3c92e09ca846e86a09e5b4c5d16be1 /src/core/components/elements/Sidebar/Sidebar.jsx | |
| parent | 3c559031623649a67825ff47f34512f0eb946861 (diff) | |
prettier
Diffstat (limited to 'src/core/components/elements/Sidebar/Sidebar.jsx')
| -rw-r--r-- | src/core/components/elements/Sidebar/Sidebar.jsx | 84 |
1 files changed, 46 insertions, 38 deletions
diff --git a/src/core/components/elements/Sidebar/Sidebar.jsx b/src/core/components/elements/Sidebar/Sidebar.jsx index 48ceacf6..08f1fed5 100644 --- a/src/core/components/elements/Sidebar/Sidebar.jsx +++ b/src/core/components/elements/Sidebar/Sidebar.jsx @@ -1,20 +1,16 @@ -import Link from "../Link/Link" -import greeting from "@/core/utils/greeting" -import useAuth from "@/core/hooks/useAuth" -import { AnimatePresence, motion } from "framer-motion" -import { CogIcon } from "@heroicons/react/24/outline" +import Link from '../Link/Link' +import greeting from '@/core/utils/greeting' +import useAuth from '@/core/hooks/useAuth' +import { AnimatePresence, motion } from 'framer-motion' +import { CogIcon } from '@heroicons/react/24/outline' -const Sidebar = ({ - active, - close -}) => { +const Sidebar = ({ active, close }) => { const auth = useAuth() const SidebarLink = ({ children, ...props }) => ( - <Link - {...props} - onClick={close} - >{ children }</Link> + <Link {...props} onClick={close}> + {children} + </Link> ) const itemClassName = 'px-4 py-3 block !text-gray_r-12/80 font-normal' @@ -23,10 +19,10 @@ const Sidebar = ({ return ( <> <AnimatePresence> - { active && ( + {active && ( <> <motion.div - className="overlay z-50" + className='overlay z-50' initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} @@ -34,55 +30,67 @@ const Sidebar = ({ onClick={close} /> <motion.div - className="fixed z-[55] top-0 h-full w-[80%] bg-white" + className='fixed z-[55] top-0 h-full w-[80%] bg-white' initial={{ left: '-80%' }} animate={{ left: 0 }} exit={{ left: '-80%' }} transition={transition} > - <div className="divide-y divide-gray_r-6"> - <div className="p-4 flex gap-x-3"> - { !auth && ( + <div className='divide-y divide-gray_r-6'> + <div className='p-4 flex gap-x-3'> + {!auth && ( <> - <Link onClick={close} href="/register" className="btn-yellow !text-gray_r-12 py-2 flex-1">Daftar</Link> - <Link onClick={close} href="/login" className="btn-solid-red !text-gray_r-1 py-2 flex-1">Masuk</Link> + <Link + onClick={close} + href='/register' + className='btn-yellow !text-gray_r-12 py-2 flex-1' + > + Daftar + </Link> + <Link + onClick={close} + href='/login' + className='btn-solid-red !text-gray_r-1 py-2 flex-1' + > + Masuk + </Link> </> - ) } - { auth && ( + )} + {auth && ( <> - <div className="text-caption-2 text-gray_r-11"> - { greeting() }, - <span className="text-body-2 text-gray_r-12 block mt-1 font-medium"> - { auth?.name } + <div className='text-caption-2 text-gray_r-11'> + {greeting()}, + <span className='text-body-2 text-gray_r-12 block mt-1 font-medium'> + {auth?.name} </span> </div> - <Link - onClick={close} - href="/my/menu" - className="!text-gray_r-11 ml-auto my-auto" + <Link + onClick={close} + href='/my/menu' + className='!text-gray_r-11 ml-auto my-auto' > - <CogIcon className="w-6" /> + <CogIcon className='w-6' /> </Link> </> - ) } + )} </div> - <SidebarLink className={itemClassName} href="/"> + <SidebarLink className={itemClassName} href='/'> Semua Brand </SidebarLink> - <SidebarLink className={itemClassName} href="/"> + <SidebarLink className={itemClassName} href='/'> Tentang Indoteknik </SidebarLink> - <SidebarLink className={itemClassName} href="/"> + <SidebarLink className={itemClassName} href='/'> Pusat Bantuan </SidebarLink> <button className={`${itemClassName} w-full text-left`}>Kategori</button> </div> </motion.div> </> - ) } + )} </AnimatePresence> </> ) } -export default Sidebar
\ No newline at end of file +export default Sidebar |
