Skip to content

Commit

Permalink
stop sheet from displaying console errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 committed Oct 16, 2024
1 parent e2dd272 commit a221e69
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions web/src/components/overlay/dialog/PlatformAwareDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet";
import {
Sheet,
SheetContent,
SheetDescription,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";
import { isMobile } from "react-device-detect";

type PlatformAwareDialogProps = {
Expand Down Expand Up @@ -52,16 +59,20 @@ export default function PlatformAwareDialog({

type PlatformAwareSheetProps = {
trigger: JSX.Element;
title?: string | JSX.Element;
content: JSX.Element;
triggerClassName?: string;
titleClassName?: string;
contentClassName?: string;
open: boolean;
onOpenChange: (open: boolean) => void;
};
export function PlatformAwareSheet({
trigger,
title,
content,
triggerClassName = "",
titleClassName = "",
contentClassName = "",
open,
onOpenChange,
Expand Down Expand Up @@ -90,7 +101,15 @@ export function PlatformAwareSheet({
<SheetTrigger asChild className={triggerClassName}>
{trigger}
</SheetTrigger>
<SheetContent className={contentClassName}>{content}</SheetContent>
<SheetContent className={contentClassName}>
<SheetHeader>
<SheetTitle className={title ? titleClassName : "sr-only"}>
{title ?? ""}
</SheetTitle>
<SheetDescription className="sr-only">Information</SheetDescription>
</SheetHeader>
{content}
</SheetContent>
</Sheet>
);
}

0 comments on commit a221e69

Please sign in to comment.