import type { Meta, StoryObj } from "@storybook/react"; import type { StickyOnMobileProps } from "./StickyOnMobile"; import { StickyOnMobile } from "./StickyOnMobile"; import { excludeControls } from "../../utils"; import { Button } from "../Button"; import { Stack } from "../Stack"; import { Text } from "../Text"; import { TextField } from "../TextField"; type StoryType = StoryObj; const meta: Meta = { title: "Layout/StickyOnMobile", component: StickyOnMobile, argTypes: { ...excludeControls("className", "style", "children"), elementType: { control: { type: "text" }, }, }, parameters: { docs: { description: { component: "A thin layout wrapper that pins a single child to the bottom of the viewport on mobile (≤ 768px) using `position: fixed` and renders in document flow on desktop. Designed to wrap CTAs such as the post-quote Combined Payments checkout button.", }, }, }, }; const FillerContent = () => ( {Array.from({ length: 12 }).map((_, i) => ( Scroll the canvas on a mobile viewport (≤ 768px) — the Checkout button below stays clamped to the bottom of the visible area while content scrolls behind it. On desktop it just renders in flow. ))} ); export const Default: StoryType = { render: (args: StickyOnMobileProps) => ( ), }; export const KeyboardTest: StoryType = { parameters: { docs: { description: { story: "Manual QA surface for soft-keyboard behaviour. Storybook viewport addon does NOT simulate the keyboard — open this on a real (or simulator) iPhone and Android, focus the input, and observe whether the sticky bar gets covered. iOS Safari is the case the ticket flags for Browserstack.", }, }, }, render: (args: StickyOnMobileProps) => ( ), }; export const AsFooterElement: StoryType = { render: (args: StickyOnMobileProps) => ( ), args: { elementType: "footer", }, }; export default meta;