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:
2026-04-23 12:30:38 +10:00
parent 9281020d3a
commit 4a0fcd0294
2 changed files with 36 additions and 3 deletions

View File

@@ -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 — add packages and see the bar update */

View File

@@ -159,9 +159,12 @@ export const CompareLoading: Story = {
},
};
/** "In comparison" selected state — package is already in the basket.
* The Compare button is swapped for a soft-brand-tinted inert pill
* with a check icon; removal happens via the CompareBar, not here. */
/** "Added to comparison" state — package is already in the basket.
* The Compare button keeps its default soft/secondary chrome + "Compare"
* 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 = {
args: {
name: 'Traditional Family Cremation Service',