{SIZES.map(preset => (
setOpen(preset.size)}>
{preset.label} {preset.width}
))}
{
if (!next) setOpen(null)
}}
>
Change the size from the toolbar menu, or drag the inner edge for a width in between.
Either choice is remembered for this rail.
)
}
const RECORDS = ["Avery Chen", "Jordan Lee", "Sam Rivera", "Priya Nair"]
/** Record stepping plus a filled right-hand actions cluster. */
export function FloatingSheetToolbarPreview() {
const [open, setOpen] = React.useState(false)
const [index, setIndex] = React.useState(0)
const [starred, setStarred] = React.useState(false)
return (
setOpen(true)}>Open record 0 ? () => setIndex(n => n - 1) : undefined}
onNext={index < RECORDS.length - 1 ? () => setIndex(n => n + 1) : undefined}
previousLabel="Previous student"
nextLabel="Next student"
actions={
<>
Copy linkShareOpen as page
>
}
/>
Step through the list without going back to the hub. Wire previous and next only when
the rail is showing one of an ordered set; leave them off for Export or Properties.
)
}
const HEADER_VARIANTS = [
{
id: "title",
label: "Title only",
title: "Resume instructions",
body: "The quietest header. Use it when the title says everything.",
},
{
id: "description",
label: "With description",
title: "Import students",
description:
"Nothing is overwritten. Existing records are matched on their workspace ID and updated in place.",
body: "Use a description for a rule the user needs before they act.",
},
{
id: "subtitle",
label: "With subtitle",
title: "Properties",
subtitle: "Active placements",
body: "A subtitle is one line of meta: a count, a state, a record ID. Not a sentence.",
},
] as const
export function FloatingSheetHeaderVariantsPreview() {
const [open, setOpen] = React.useState(null)
const active = HEADER_VARIANTS.find(variant => variant.id === open)
return (
)
}
/** Two rails that compete for the same edge, to show the swap. */
export function FloatingSheetSingleRailPreview() {
const [rail, setRail] = React.useState<"properties" | "export" | null>(null)
return (
setRail("properties")}>Open properties setRail("export")}>Open export {
if (!next) setRail(current => (current === "properties" ? null : current))
}}
>
Open export while this is up. This rail closes rather than stacking behind it. {
if (!next) setRail(current => (current === "export" ? null : current))
}}
>
Each rail still owns its own open state. The group only asks the previous one to close.
)
}
/** Shows the non-modal page behind plus the drag handle. */
export function FloatingSheetLivePagePreview() {
const [open, setOpen] = React.useState(false)
const [count, setCount] = React.useState(0)
return (
setOpen(true)}>Open rail
With this open, the counter button behind still works and the page still scrolls.
Clicking out there will not dismiss the rail, so a half-filled form survives a stray
click. Escape and the toolbar close button are the way out.