fix(map): one close button on the spot sheet
SheetContent renders a built-in close X, and SpotBottomSheet adds its own in the header row - so tapping a spot showed two. Added an opt-in hideClose prop to SheetContent and used it on the spot sheet (which keeps its own, placed in the header). Also padded the new mint sheet header clear of the built-in close.
This commit is contained in:
parent
daedf7ac57
commit
8394d006dd
3 changed files with 13 additions and 7 deletions
|
|
@ -49,12 +49,15 @@ const sheetVariants = cva(
|
||||||
|
|
||||||
interface SheetContentProps
|
interface SheetContentProps
|
||||||
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
||||||
VariantProps<typeof sheetVariants> { }
|
VariantProps<typeof sheetVariants> {
|
||||||
|
/** Hide the built-in close button — for sheets that render their own. */
|
||||||
|
hideClose?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
const SheetContent = React.forwardRef<
|
const SheetContent = React.forwardRef<
|
||||||
React.ElementRef<typeof SheetPrimitive.Content>,
|
React.ElementRef<typeof SheetPrimitive.Content>,
|
||||||
SheetContentProps
|
SheetContentProps
|
||||||
>(({ side = "right", className, children, ...props }, ref) => (
|
>(({ side = "right", className, children, hideClose = false, ...props }, ref) => (
|
||||||
<SheetPortal>
|
<SheetPortal>
|
||||||
<SheetOverlay />
|
<SheetOverlay />
|
||||||
<SheetPrimitive.Content
|
<SheetPrimitive.Content
|
||||||
|
|
@ -63,10 +66,12 @@ const SheetContent = React.forwardRef<
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
|
{!hideClose && (
|
||||||
<X className="h-4 w-4" />
|
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
|
||||||
<span className="sr-only">Close</span>
|
<X className="h-4 w-4" />
|
||||||
</SheetPrimitive.Close>
|
<span className="sr-only">Close</span>
|
||||||
|
</SheetPrimitive.Close>
|
||||||
|
)}
|
||||||
</SheetPrimitive.Content>
|
</SheetPrimitive.Content>
|
||||||
</SheetPortal>
|
</SheetPortal>
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -2058,6 +2058,7 @@ export default function MapPage() {
|
||||||
<Sheet open={!!selectedSpot} onOpenChange={(open) => { if (!open) setSelectedSpot(null); }}>
|
<Sheet open={!!selectedSpot} onOpenChange={(open) => { if (!open) setSelectedSpot(null); }}>
|
||||||
<SheetContent
|
<SheetContent
|
||||||
side="bottom"
|
side="bottom"
|
||||||
|
hideClose
|
||||||
className="h-auto max-h-[55vh] rounded-t-2xl px-0 pb-0 bg-black/95 border-t border-white/10"
|
className="h-auto max-h-[55vh] rounded-t-2xl px-0 pb-0 bg-black/95 border-t border-white/10"
|
||||||
>
|
>
|
||||||
<SheetTitle className="sr-only">{selectedSpot?.title ?? 'Spot details'}</SheetTitle>
|
<SheetTitle className="sr-only">{selectedSpot?.title ?? 'Spot details'}</SheetTitle>
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ export default function MintsPage() {
|
||||||
{selected && (
|
{selected && (
|
||||||
<>
|
<>
|
||||||
<SheetHeader className="pb-3 text-left">
|
<SheetHeader className="pb-3 text-left">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3 pr-8">
|
||||||
{selected.iconUrl ? (
|
{selected.iconUrl ? (
|
||||||
<img
|
<img
|
||||||
src={selected.iconUrl}
|
src={selected.iconUrl}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue