feat: Preferences view layout on mobile has been updated, and can be dismissed by swiping from the right

This commit is contained in:
Aman Harwara
2023-05-17 19:42:08 +05:30
parent 7b44224314
commit e5c580deab
18 changed files with 114 additions and 79 deletions

View File

@@ -6,29 +6,32 @@ import { useModalAnimation } from '../Modal/useModalAnimation'
type Props = {
isOpen: boolean
children: ReactNode
animationVariant?: 'horizontal' | 'vertical'
}
const ModalOverlay = forwardRef(({ isOpen, children, ...props }: Props, ref: ForwardedRef<HTMLDivElement>) => {
const [isMounted, setElement] = useModalAnimation(isOpen)
const dialog = useDialogStore({
open: isMounted,
})
const ModalOverlay = forwardRef(
({ isOpen, children, animationVariant, ...props }: Props, ref: ForwardedRef<HTMLDivElement>) => {
const [isMounted, setElement] = useModalAnimation(isOpen, animationVariant)
const dialog = useDialogStore({
open: isMounted,
})
if (!isMounted) {
return null
}
if (!isMounted) {
return null
}
return (
<Dialog
tabIndex={0}
className="fixed top-0 left-0 z-modal h-full w-full"
ref={mergeRefs([setElement, ref])}
store={dialog}
{...props}
>
{children}
</Dialog>
)
})
return (
<Dialog
tabIndex={0}
className="fixed top-0 left-0 z-modal h-full w-full"
ref={mergeRefs([setElement, ref])}
store={dialog}
{...props}
>
{children}
</Dialog>
)
},
)
export default ModalOverlay