Skip to content

Store editor

Promo media field

Upload and crop for the promotional still.
Available
Needs mock props

Examples

Rendered live from the maintained Storybook story. Lantern stores only the story id and embeds Storybook rather than duplicating the component or its demo.

Promo media field

Rendered live from Storybook

Storybook must be running for this to load — bun run start:storybook from the monorepo root, or set NEXT_PUBLIC_STORYBOOK_URL to a deployed instance.

Props

The component's public API, read from its TypeScript source. Descriptions come from TSDoc on the prop, so this table cannot drift from the component.

PropTypeDefaultDescription
images*string[]—Ordered promo stills. First entry is the product's cover.
onImagesChange*(images: string[]) => void—Receives the whole next array — after an add, a remove or a reorder.
selectedIndexnumber—Fully controlled hero selection. Pair with `onSelectedIndexChange`.
initialSelectedIndexnumber0Uncontrolled seed for the hero selection. Lifts the `useState` for snapshots.
onSelectedIndexChange(index: number) => void—Undocumented — add TSDoc to the prop in the library.
forceDropTargetPromoDropTarget | null—Renders the reorder caret statically. Drag-and-drop is a gesture, so the indicator is otherwise unreachable in a snapshot.
forceDragIndexnumber | null—Pretend this thumbnail is the one being dragged. Pairs with `forceDropTarget`.
toImageValue(file: File, index: number) => string() => PLACEHOLDER_PROMO_IMAGETurns a picked file into the string held in `images`. The app ran a `FileReader` and stored a base64 data URL; the default here hands back the inline placeholder, which keeps the field synchronous and side-effect free.
acceptstring"image/*Undocumented — add TSDoc to the prop in the library.
uploadLabelstring"Click to upload"Empty-state headline.
fileTypesLabelstring"PNGEmpty-state sub-line listing accepted formats.
classNamestring—Undocumented — add TSDoc to the prop in the library.

Reference

Transcribed from the component audit. If this disagrees with the source, the source is right.

Source
src/components/store/editor/PromoMediaField.tsx
Portability
Needs its app dependencies replaced by props before it renders in isolation.