File tree Expand file tree Collapse file tree 4 files changed +29
-23
lines changed
apps/web/src/components/Modals/ModalBase
packages/ui/components/layouts Expand file tree Collapse file tree 4 files changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,23 @@ import { cn } from "@mav/shared/utils"
44import dynamic from "next/dynamic"
55import { useEffect } from "react"
66
7- const Portal = dynamic ( ( ) => import ( "./Portal" ) , { ssr : false } )
7+ const Portal = dynamic (
8+ ( ) => import ( "@mav/ui/components/layouts" ) . then ( ( c ) => c . Portal ) ,
9+ {
10+ ssr : false
11+ }
12+ )
13+
14+ interface OverlayProps {
15+ state ?: unknown
16+ toggler ?: React . Dispatch < React . SetStateAction < boolean > >
17+ }
818
919export default function Overlay ( {
1020 children,
1121 state,
1222 toggler
13- } : {
14- children ?: React . ReactNode
15- state ?: unknown
16- toggler ?: React . Dispatch < React . SetStateAction < boolean > >
17- } ) {
23+ } : React . PropsWithChildren < OverlayProps > ) {
1824 useEffect ( ( ) => {
1925 const bodyStyle = document . body . style
2026
@@ -29,7 +35,7 @@ export default function Overlay({
2935 return (
3036 < Portal >
3137 < div
32- onClick = { toggler as ( ) => any }
38+ onClick = { toggler as ( ) => void }
3339 className = { cn (
3440 "fixed inset-0 z-[99] bg-black/60 transition-all duration-[350ms]" ,
3541 state ? "opacity-100" : "pointer-events-none opacity-0"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { createPortal } from "react-dom"
2+
3+ interface PortalProps {
4+ style ?: React . CSSProperties
5+ }
6+
7+ export function Portal ( props : React . PropsWithChildren < PortalProps > ) {
8+ return createPortal (
9+ < div data-mav-portal = "" style = { props . style ?? undefined } >
10+ { props . children }
11+ </ div > ,
12+ document . body
13+ )
14+ }
Original file line number Diff line number Diff line change @@ -4,4 +4,6 @@ export * from "./Group/Group"
44export * from "./Group/GroupContainer"
55export * from "./MarginGutter"
66
7+ export * from "./Portal"
8+
79export type * from "./Masthead/Masthead.types"
You can’t perform that action at this time.
0 commit comments