Stories: mobile CompareBar + refreshed InCart description
- CompareBar: add Mobile and MobileSingle stories (viewport: mobile1) so the xs-only collapse / auto-peek behaviour is discoverable in Storybook without setting up a live basket. - PackageDetail InCart story description updated to match the final toggle pattern (was stale from the earlier inert-pill attempt). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -85,6 +85,36 @@ export const Empty: Story = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// --- Mobile ------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Mobile viewport — expanded by default, with a grey-filled right-chevron
|
||||||
|
* on the right of the pill. Tap the chevron to retract the pill to the
|
||||||
|
* right corner (the middle content animates to width:0, so the pill
|
||||||
|
* visually shrinks as one unit rather than swapping into a separate mini
|
||||||
|
* pill). Tap the left-chevron on the collapsed pill to expand. On add
|
||||||
|
* while collapsed, the full bar auto-peeks for 3s, then re-collapses. */
|
||||||
|
export const Mobile: Story = {
|
||||||
|
args: {
|
||||||
|
packages: samplePackages.slice(0, 2),
|
||||||
|
onCompare: () => alert('Compare clicked'),
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
viewport: { defaultViewport: 'mobile1' },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Mobile — single package state. Same behaviour as `Mobile`, Compare
|
||||||
|
* CTA disabled ("Add another to compare"). */
|
||||||
|
export const MobileSingle: Story = {
|
||||||
|
args: {
|
||||||
|
packages: samplePackages.slice(0, 1),
|
||||||
|
onCompare: () => alert('Compare clicked'),
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
viewport: { defaultViewport: 'mobile1' },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// --- Interactive Demo --------------------------------------------------------
|
// --- Interactive Demo --------------------------------------------------------
|
||||||
|
|
||||||
/** Interactive demo — add packages and see the bar update */
|
/** Interactive demo — add packages and see the bar update */
|
||||||
|
|||||||
@@ -159,9 +159,12 @@ export const CompareLoading: Story = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** "In comparison" selected state — package is already in the basket.
|
/** "Added to comparison" state — package is already in the basket.
|
||||||
* The Compare button is swapped for a soft-brand-tinted inert pill
|
* The Compare button keeps its default soft/secondary chrome + "Compare"
|
||||||
* with a check icon; removal happens via the CompareBar, not here. */
|
* label, and gains a trailing check icon. Click is a toggle — the
|
||||||
|
* caller wires `onCompare` to add-or-remove based on the `inCart` prop
|
||||||
|
* it's passing in (e.g. via `basket.toggle(key)`). aria-pressed and the
|
||||||
|
* aria-label spell out the state for SR users. */
|
||||||
export const InCart: Story = {
|
export const InCart: Story = {
|
||||||
args: {
|
args: {
|
||||||
name: 'Traditional Family Cremation Service',
|
name: 'Traditional Family Cremation Service',
|
||||||
|
|||||||
Reference in New Issue
Block a user