feat(dialog): apply ServerSideDocumentFallback

This commit is contained in:
p-sw 2024-07-12 01:11:56 +09:00
parent eb8ea83336
commit da628710a4

View File

@ -1,4 +1,9 @@
import { Slot, type VariantProps, vcn } from "@pswui-lib"; import {
ServerSideDocumentFallback,
Slot,
type VariantProps,
vcn,
} from "@pswui-lib";
import React, { type ReactNode, useState } from "react"; import React, { type ReactNode, useState } from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
@ -100,8 +105,9 @@ const DialogOverlay = React.forwardRef<HTMLDivElement, DialogOverlay>(
}); });
const { children, closeOnClick, onClick, ...otherPropsExtracted } = const { children, closeOnClick, onClick, ...otherPropsExtracted } =
otherPropsCompressed; otherPropsCompressed;
return ( return (
<> <ServerSideDocumentFallback>
{ReactDOM.createPortal( {ReactDOM.createPortal(
<div <div
{...otherPropsExtracted} {...otherPropsExtracted}
@ -125,7 +131,7 @@ const DialogOverlay = React.forwardRef<HTMLDivElement, DialogOverlay>(
</div>, </div>,
document.body, document.body,
)} )}
</> </ServerSideDocumentFallback>
); );
}, },
); );