🎨 styles: add cart drawer layer

:%s
This commit is contained in:
lytrankieio123
2021-09-15 13:53:24 +07:00
parent 315f6748c9
commit b9e47ef299
3 changed files with 52 additions and 20 deletions

View File

@@ -11,22 +11,32 @@ interface Props {
}
const DrawerCommon = ({ title, visible, children, onClose }: Props) => {
const refInner = useRef<HTMLDivElement>(null)
const handleClickOut = (e: any) => {
if (e.target.contains(refInner.current)) {
onClose()
}
}
return (
<div className={classNames({
[s.drawerCommon]: true,
[s.hide]: !visible
[s.show]: visible
})}>
<div className={s.inner}>
<div className={s.top}>
<h4 className={s.heading}>
{title}
</h4>
<div className={s.iconClose} onClick={onClose}>
<IconClose />
<div className={s.innerWrap} onClick={handleClickOut}>
<div className={s.inner} ref={refInner}>
<div className={s.top}>
<h4 className={s.heading}>
{title}
</h4>
<div className={s.iconClose} onClick={onClose}>
<IconClose />
</div>
</div>
<div className={s.content}>
{children}
</div>
</div>
<div className={s.content}>
{children}
</div>
</div>
</div>