import React from "react"; import { Meta, StoryFn } from "@storybook/react"; import { helpersArgTypes } from "../../../../.storybook/helpers"; import SearchField from "./../SearchField"; export default { title: "Components/SearchField", component: SearchField, argTypes: { leftIcon: { ...helpersArgTypes.exampleIcon, }, rightElement: { ...helpersArgTypes.exampleIcon, }, fullWidth: { table: { disable: true } }, }, } as Meta; const Template: StoryFn = (args) => ; export const Default = Template.bind({}); Default.args = { onClearanceHandler: null, onClearanceText: "", }; const SearchFieldWithClearanceIconTemplate: StoryFn = (args) => { const [query, setQuery] = React.useState(""); return ( setQuery((e.target as HTMLInputElement).value)} onClearanceHandler={() => setQuery("")} /> ); }; export const SearchFieldWithClearanceIcon = SearchFieldWithClearanceIconTemplate.bind({}); SearchFieldWithClearanceIcon.args = { onClearanceHandler: null, onClearanceText: "Clear field", };