From d1f657342a982a1d639ed819639cd52668e418de Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Thu, 16 Apr 2026 11:33:53 -0700 Subject: [PATCH] Fix statusbar over slide out panes in PWA. Closes #191. --- frontend/src/components/ui/sheet.tsx | 59 ++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/ui/sheet.tsx b/frontend/src/components/ui/sheet.tsx index c1497c6..30e1eca 100644 --- a/frontend/src/components/ui/sheet.tsx +++ b/frontend/src/components/ui/sheet.tsx @@ -56,15 +56,68 @@ interface SheetContentProps hideCloseButton?: boolean; } +// Safe-area insets for each sheet side. Sheets are position:fixed and escape +// body padding, so without this they render under the iOS status bar/home +// indicator when the app is installed as a PWA. +// +// NOTE: these inline styles override the matching sides of the `p-6` default +// in sheetVariants. All current consumers pass `p-0`; future sheets that want +// the default padding should compose explicit per-side padding in their own +// className rather than relying on the `p-6` shorthand being preserved. +type SheetSide = Exclude['side'], null | undefined>; + +const sheetSafeAreaStyles: Record = { + top: { + paddingTop: 'var(--safe-area-top)', + paddingLeft: 'var(--safe-area-left)', + paddingRight: 'var(--safe-area-right)', + }, + bottom: { + paddingBottom: 'var(--safe-area-bottom)', + paddingLeft: 'var(--safe-area-left)', + paddingRight: 'var(--safe-area-right)', + }, + left: { + paddingTop: 'var(--safe-area-top)', + paddingLeft: 'var(--safe-area-left)', + paddingBottom: 'var(--safe-area-bottom)', + }, + right: { + paddingTop: 'var(--safe-area-top)', + paddingRight: 'var(--safe-area-right)', + paddingBottom: 'var(--safe-area-bottom)', + }, +}; + const SheetContent = React.forwardRef< React.ElementRef, SheetContentProps ->(({ side = 'right', className, children, hideCloseButton = false, ...props }, ref) => ( +>(({ side = 'right', className, children, hideCloseButton = false, style, ...props }, ref) => ( - + {!hideCloseButton && ( - + Close