// Copyright (c) Meta Platforms, Inc. and affiliates. 'use client'; import {useState} from 'react'; import { BottomSheet, type BottomSheetSnapPoint, } from '@astryxdesign/core/BottomSheet'; import {Button} from '@astryxdesign/core/Button'; import {Divider} from '@astryxdesign/core/Divider'; import {Heading} from '@astryxdesign/core/Heading'; import {Icon} from '@astryxdesign/core/Icon'; import {Item} from '@astryxdesign/core/Item'; import {HStack, VStack} from '@astryxdesign/core/Stack'; import {Text} from '@astryxdesign/core/Text'; import { ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUturnLeftIcon as UndoIcon, FlagIcon, MapPinIcon as LocationIcon, } from '@heroicons/react/24/outline'; // Half the viewport is a working surface โ€” the sheet lays its content out at // that height and keeps a full scrim. The 96px stop is a peek: a sliver, so the // sheet slides away rather than reflowing into it, and the scrim thins. const SNAP_POINTS: ReadonlyArray = ['96px', '50%']; const steps = [ { icon: LocationIcon, label: 'Head northeast on Mission St', detail: 'Toward 3rd St', distance: '350 ft', }, { icon: ArrowRightIcon, label: 'Turn right onto 3rd St', detail: 'Pass Yerba Buena Gardens on your left', distance: '0.2 mi', }, { icon: ArrowUpIcon, label: 'Continue onto Kearny St', detail: 'Stay in the right lane', distance: '0.4 mi', }, { icon: ArrowLeftIcon, label: 'Turn left onto Market St', detail: 'Cable car crossing ahead', distance: '0.6 mi', }, { icon: ArrowRightIcon, label: 'Bear right onto Sutter St', detail: 'Toward the Financial District', distance: '0.3 mi', }, { icon: ArrowUpIcon, label: 'Continue on Sansome St', detail: 'Four blocks, past Pine St', distance: '0.5 mi', }, { icon: UndoIcon, label: 'Make a U-turn at Washington St', detail: 'Construction detour until March', distance: '150 ft', }, { icon: ArrowRightIcon, label: 'Turn right onto Battery St', detail: 'Follow signs for the Embarcadero', distance: '0.4 mi', }, { icon: ArrowLeftIcon, label: 'Turn left onto Sacramento St', detail: 'Toward the waterfront', distance: '0.2 mi', }, { icon: ArrowRightIcon, label: 'Turn right onto The Embarcadero', detail: 'Bay Bridge on your right', distance: '0.5 mi', }, { icon: ArrowUpIcon, label: 'Continue past Pier 14', detail: 'Ferry terminal signage begins here', distance: '0.3 mi', }, { icon: FlagIcon, label: 'Arrive at the Ferry Building', detail: 'Parking garage entrance on Washington St', distance: 'โ€”', }, ]; export default function BottomSheetSnapPoints() { const [isOpen, setIsOpen] = useState(false); return ( <> This sheet has two extra stops: half the viewport, and a 96px peek. Drag the handle down to collapse it, then back up โ€” it rests at each stop instead of following your finger.