fix sheet portal (#1237)

This commit is contained in:
an-lee
2024-12-10 12:02:10 +08:00
committed by GitHub
parent 67a71dbe9d
commit 09ab8c54b6
7 changed files with 23 additions and 6 deletions

View File

@@ -692,6 +692,7 @@ export const MediaCurrentRecording = () => {
<Sheet open={detailIsOpen} onOpenChange={(open) => setDetailIsOpen(open)}>
<SheetContent
container="main-panel-content"
aria-describedby={undefined}
side="bottom"
className="rounded-t-2xl shadow-lg max-h-content overflow-y-scroll"

View File

@@ -295,6 +295,7 @@ export const AssistantMessageComponent = (props: {
onOpenChange={(value) => setShadowing(value)}
>
<SheetContent
container="main-panel-content"
aria-describedby={undefined}
side="bottom"
className="h-content p-0 flex flex-col gap-0"

View File

@@ -30,11 +30,15 @@ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
const AlertDialogContent = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> & {
container?: HTMLElement;
container?: HTMLElement | string;
}
>(({ className, container, ...props }, ref) => (
<AlertDialogPortal
container={container || document.getElementById("main-panel-content")}
container={
typeof container === "string"
? document.getElementById(container)
: container
}
>
<AlertDialogOverlay className="absolute inset-0" />
<AlertDialogPrimitive.Content

View File

@@ -32,11 +32,15 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
container?: HTMLElement;
container?: HTMLElement | string;
}
>(({ className, children, container, ...props }, ref) => (
<DialogPortal
container={container || document.getElementById("main-panel-content")}
container={
typeof container === "string"
? document.getElementById(container)
: container
}
>
<DialogOverlay />
<DialogPrimitive.Content

View File

@@ -53,7 +53,7 @@ interface SheetContentProps
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
VariantProps<typeof sheetVariants> {
displayClose?: boolean;
container?: HTMLElement;
container?: HTMLElement | string;
}
const SheetContent = React.forwardRef<
@@ -72,7 +72,11 @@ const SheetContent = React.forwardRef<
ref
) => (
<SheetPortal
container={container || document.getElementById("main-panel-content")}
container={
typeof container === "string"
? document.getElementById(container)
: container
}
>
<SheetOverlay className="absolute" />
<SheetPrimitive.Content

View File

@@ -481,6 +481,7 @@ export const ChatSessionProvider = ({
}}
>
<SheetContent
container="main-panel-content"
side="bottom"
className="h-content p-0 flex flex-col gap-0"
displayClose={false}
@@ -506,6 +507,7 @@ export const ChatSessionProvider = ({
}}
>
<SheetContent
container="main-panel-content"
aria-describedby={undefined}
side="bottom"
className="rounded-t-2xl shadow-lg max-h-content overflow-y-scroll"

View File

@@ -71,6 +71,7 @@ export const CourseProvider = ({
}}
>
<SheetContent
container="main-panel-content"
side="bottom"
className="h-content p-0 flex flex-col gap-0"
displayClose={false}