Skip to content

Commit b631b0c

Browse files
committed
fix(mobile): hide SheetContent built-in close button in ChatBottomSheet to avoid duplicate X
1 parent 7e78e51 commit b631b0c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

apps/mesh/src/web/components/chat/chat-bottom-sheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export function ChatBottomSheet() {
1010
<SheetContent
1111
side="bottom"
1212
className="h-[calc(100svh-1.25rem)] p-0 rounded-t-xl border-0"
13+
hideCloseButton
1314
>
1415
<ChatPanel />
1516
</SheetContent>

packages/ui/src/components/sheet.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ function SheetContent({
4848
className,
4949
children,
5050
side = "right",
51+
hideCloseButton,
5152
...props
5253
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
5354
side?: "top" | "right" | "bottom" | "left";
55+
hideCloseButton?: boolean;
5456
}) {
5557
return (
5658
<SheetPortal>
@@ -72,10 +74,12 @@ function SheetContent({
7274
{...props}
7375
>
7476
{children}
75-
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
76-
<X className="size-4" />
77-
<span className="sr-only">Close</span>
78-
</SheetPrimitive.Close>
77+
{!hideCloseButton && (
78+
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
79+
<X className="size-4" />
80+
<span className="sr-only">Close</span>
81+
</SheetPrimitive.Close>
82+
)}
7983
</SheetPrimitive.Content>
8084
</SheetPortal>
8185
);

0 commit comments

Comments
 (0)