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.
| Prop | Type | Default | Description |
|---|---|---|---|
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. |
selectedIndex | number | — | Fully controlled hero selection. Pair with `onSelectedIndexChange`. |
initialSelectedIndex | number | 0 | Uncontrolled seed for the hero selection. Lifts the `useState` for snapshots. |
onSelectedIndexChange | (index: number) => void | — | Undocumented — add TSDoc to the prop in the library. |
forceDropTarget | PromoDropTarget | null | — | Renders the reorder caret statically. Drag-and-drop is a gesture, so the indicator is otherwise unreachable in a snapshot. |
forceDragIndex | number | null | — | Pretend this thumbnail is the one being dragged. Pairs with `forceDropTarget`. |
toImageValue | (file: File, index: number) => string | () => PLACEHOLDER_PROMO_IMAGE | Turns 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. |
accept | string | "image/* | Undocumented — add TSDoc to the prop in the library. |
uploadLabel | string | "Click to upload" | Empty-state headline. |
fileTypesLabel | string | "PNG | Empty-state sub-line listing accepted formats. |
className | string | — | 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.