feat: post modal open site home

This commit is contained in:
DIYgod 2023-07-08 01:02:48 +01:00
parent 3fe25d13a7
commit 8a92d7b82c
No known key found for this signature in database
2 changed files with 25 additions and 6 deletions

View File

@ -55,7 +55,7 @@ export default async function SiteModal({
}
return (
<PostModal>
<PostModal handle={site?.handle}>
<div className="pb-16">
<SiteHeader
handle={params.site}

View File

@ -4,8 +4,17 @@ import { useRouter } from "next/navigation"
import { useEffect, useState } from "react"
import { Modal } from "~/components/ui/Modal"
import { getSiteLink } from "~/lib/helpers"
export default function SiteModal({ children }: { children: JSX.Element }) {
import { UniLink } from "../ui/UniLink"
export default function PostModal({
handle,
children,
}: {
handle: string
children: JSX.Element
}) {
const router = useRouter()
const [open, setOpen] = useState(false)
@ -16,19 +25,29 @@ export default function SiteModal({ children }: { children: JSX.Element }) {
return (
<Modal
open={open}
boxClassName="pt-12"
// boxClassName="pt-12"
panelClassName="max-w-[888px] rounded-xl relative overflow-visible"
zIndex={9}
setOpen={() => router.back()}
>
<div
className="text-3xl absolute bottom-full text-white cursor-pointer"
className="text-3xl absolute right-full text-white cursor-pointer mr-2 mt-2 space-y-2"
onClick={() => {
window.open(window.location.href)
router.back()
}}
>
<i className="icon-[mingcute--expand-player-line]" />
<UniLink className="block" href={window.location.href} target="_blank">
<i className="icon-[mingcute--expand-player-line]" />
</UniLink>
<UniLink
className="block"
href={getSiteLink({
subdomain: handle,
})}
target="_blank"
>
<i className="icon-[mingcute--user-3-line]" />
</UniLink>
</div>
<div className="h-full overflow-y-auto rounded-xl">{children}</div>
</Modal>