import { Text } from "../../../components/text"; import { useBpAwareProp } from "."; import type { StoryObj, Meta } from "@storybook/react"; import type { BpAware } from "../../../theme/types"; const meta: Meta = { title: "Hooks/useBpAwareProp", argTypes: { prop: { table: { category: "Input Parameters", type: { summary: "BpAware", }, }, type: "string", description: "The prop type made “breakpoint aware”", control: false, }, defaultValue: { table: { category: "Input Parameters", type: { summary: "T", }, }, type: "string", description: "Default value to be returned if prop has not defined a value for the current active breakpoint", control: false, }, "": { table: { category: "Return Value", type: { summary: "T", }, }, description: "The correct value from `prop` if it was defined otherwise `defaultValue` value is returned", control: false, type: "string", }, }, }; export default meta; type Story = StoryObj; /** * In this example `bpContent` will be `small` and `medium` respectively depending on the current active breakpoint but because the `App` did not define a value for when the largest breakpoint is active, `bpContent` will, at that point, be assigned `defaultContent`. */ export const Default: Story = { render: () => { const UiKitComponent: React.FC<{ content: BpAware; defaultContent: string }> = ({ content, defaultContent, }) => { const bpContent = useBpAwareProp(content, defaultContent); return ( {bpContent} ); }; return ( <> Content:{" "} ); }, };