bug fix in drawer

This commit is contained in:
daniel31x13 2024-01-21 00:02:59 -05:00
parent 1716e1d408
commit 1d14d17e7a
5 changed files with 39 additions and 8 deletions

1
.gitignore vendored
View File

@ -47,3 +47,4 @@ prisma/dev.db
# docker # docker
pgdata pgdata
certificates

View File

@ -9,6 +9,8 @@ type Props = {
}; };
export default function Modal({ toggleModal, className, children }: Props) { export default function Modal({ toggleModal, className, children }: Props) {
const [drawerIsOpen, setDrawerIsOpen] = React.useState(true);
useEffect(() => { useEffect(() => {
if (window.innerWidth >= 640) { if (window.innerWidth >= 640) {
document.body.style.overflow = "hidden"; document.body.style.overflow = "hidden";
@ -22,15 +24,21 @@ export default function Modal({ toggleModal, className, children }: Props) {
if (window.innerWidth < 640) { if (window.innerWidth < 640) {
return ( return (
<Drawer.Root open onClose={() => setTimeout(() => toggleModal(), 100)}> <Drawer.Root
open={drawerIsOpen}
onClose={() => setTimeout(() => toggleModal(), 100)}
>
<Drawer.Portal> <Drawer.Portal>
<Drawer.Overlay className="fixed inset-0 bg-black/40" /> <Drawer.Overlay className="fixed inset-0 bg-black/40" />
<Drawer.Content className="flex flex-col rounded-t-2xl h-[90%] mt-24 fixed bottom-0 left-0 right-0 z-30"> <ClickAwayHandler onClickOutside={() => setDrawerIsOpen(false)}>
<div className="p-4 pb-32 bg-base-100 rounded-t-2xl flex-1 border-neutral-content border-t overflow-y-auto"> <Drawer.Content className="flex flex-col rounded-t-2xl h-[90%] mt-24 fixed bottom-0 left-0 right-0 z-30">
<div className="mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-neutral mb-5" /> <div className="p-4 pb-32 bg-base-100 rounded-t-2xl flex-1 border-neutral-content border-t overflow-y-auto">
{children} <div className="mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-neutral mb-5" />
</div>
</Drawer.Content> {children}
</div>
</Drawer.Content>
</ClickAwayHandler>
</Drawer.Portal> </Drawer.Portal>
</Drawer.Root> </Drawer.Root>
); );

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

View File

@ -1,4 +1,5 @@
{ {
"id": "/dashboard",
"name":"Linkwarden", "name":"Linkwarden",
"short_name":"Linkwarden", "short_name":"Linkwarden",
"icons":[ "icons":[
@ -19,6 +20,27 @@
"purpose": "maskable" "purpose": "maskable"
} }
], ],
"share_target": {
"action": "/api/v1/links/",
"method": "POST",
"enctype": "multipart/form-data",
"params": {
"url": "link"
}
},
"screenshots": [
{
"src": "/screenshots/screenshot1.png",
"type": "image/png",
"sizes": "386x731"
},
{
"src": "/screenshots/screenshot2.png",
"type": "image/png",
"sizes": "1361x861",
"form_factor": "wide"
}
],
"theme_color":"#000000", "theme_color":"#000000",
"background_color":"#000000", "background_color":"#000000",
"display":"standalone", "display":"standalone",