Skip to content

Commit

Permalink
fix: do not use VisuallyHidden component
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jan 20, 2025
1 parent 1cee899 commit 4d45b2a
Showing 1 changed file with 6 additions and 24 deletions.
30 changes: 6 additions & 24 deletions packages/admin-ui/src/Drawer/components/DrawerHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { cn } from "~/utils";
import { type DrawerProps } from "../Drawer";
import { DrawerTitle } from "./DrawerTitle";
import { DrawerDescription } from "./DrawerDescription";
import * as VisuallyHidden from "@radix-ui/react-visually-hidden";
import { ReactComponent as XIcon } from "@material-design-icons/svg/filled/close.svg";
import { IconButton } from "~/Button";
import * as DrawerPrimitive from "@radix-ui/react-dialog";
Expand All @@ -19,28 +18,8 @@ export const DrawerHeader = ({
className,
...props
}: DrawerHeaderProps) => {
let renderedTitle = (
<DrawerTitle>
{titleIcon}
{title}
</DrawerTitle>
);
if (!title) {
renderedTitle = <VisuallyHidden.Root>{renderedTitle}</VisuallyHidden.Root>;
}

let renderedDescription = <DrawerDescription>{description}</DrawerDescription>;
if (!description) {
renderedDescription = <VisuallyHidden.Root>{renderedDescription}</VisuallyHidden.Root>;
}

if (!title && !description) {
return (
<>
{renderedTitle}
{renderedDescription}
</>
);
return null;
}

return (
Expand All @@ -57,9 +36,12 @@ export const DrawerHeader = ({
<IconButton size="md" iconSize="lg" variant={"ghost"} icon={<XIcon />} />
</DrawerPrimitive.Close>
)}
{renderedTitle}
<DrawerTitle>
{titleIcon}
{title}
</DrawerTitle>
</div>
{renderedDescription}
<DrawerDescription>{description}</DrawerDescription>
</div>
);
};

0 comments on commit 4d45b2a

Please sign in to comment.