forked from crowetic/commerce
* Adding Dropdown Component * Styling Issues * Wishlist Fix * Fixes for Wishlist View * Hearts now work again * Rollback ts * Removing extra config to disable BigCommerce * Fixes for Wishlist View * Remove transition/animation for mobile * New Updates. * New Updates. * Dropdown fix * Polish * export * export * revert tsconfig Co-authored-by: Luis Alvarez D. <luis@vercel.com> Co-authored-by: Dom Sip <dom@vercel.com> Co-authored-by: Luis Alvarez D. <luis@vercel.com>
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import React, { FC } from 'react'
|
|
import { Cross, ChevronLeft } from '@components/icons'
|
|
import { UserNav } from '@components/common'
|
|
import cn from 'clsx'
|
|
import s from './SidebarLayout.module.css'
|
|
|
|
type ComponentProps = { className?: string } & (
|
|
| { handleClose: () => any; handleBack?: never }
|
|
| { handleBack: () => any; handleClose?: never }
|
|
)
|
|
|
|
const SidebarLayout: FC<ComponentProps> = ({
|
|
children,
|
|
className,
|
|
handleBack,
|
|
handleClose,
|
|
}) => {
|
|
return (
|
|
<div className={cn(s.root, className)}>
|
|
<header className={s.header}>
|
|
{handleClose && (
|
|
<button
|
|
onClick={handleClose}
|
|
aria-label="Close"
|
|
className="hover:text-accent-5 transition ease-in-out duration-150 flex items-center focus:outline-none mr-6"
|
|
>
|
|
<Cross className="h-6 w-6 hover:text-accent-3" />
|
|
<span className="ml-2 text-accent-7 text-sm ">Close</span>
|
|
</button>
|
|
)}
|
|
{handleBack && (
|
|
<button
|
|
onClick={handleBack}
|
|
aria-label="Go back"
|
|
className="hover:text-accent-5 transition ease-in-out duration-150 flex items-center focus:outline-none"
|
|
>
|
|
<ChevronLeft className="h-6 w-6 hover:text-accent-3" />
|
|
<span className="ml-2 text-accent-7 text-xs">Back</span>
|
|
</button>
|
|
)}
|
|
|
|
<UserNav />
|
|
</header>
|
|
<div className={s.container}>{children}</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default SidebarLayout
|