saleor-dashboard/src/storybook/stories/components/Checkbox.tsx
Krzysztof Wolski a82de30309
Add circleci config and enhance our linters (#519)
* Add circleci config

* Season linting config

* Apply code style
2020-05-14 11:30:32 +02:00

39 lines
1.1 KiB
TypeScript

import Checkbox, { CheckboxProps } from "@saleor/components/Checkbox";
import Form from "@saleor/components/Form";
import { storiesOf } from "@storybook/react";
import React from "react";
import CardDecorator from "../../CardDecorator";
import Decorator from "../../Decorator";
const props: CheckboxProps = {
checked: false,
name: "data"
};
storiesOf("Generics / Checkbox", module)
.addDecorator(CardDecorator)
.addDecorator(Decorator)
.add("checked", () => <Checkbox {...props} checked={true} />)
.add("unchecked", () => <Checkbox {...props} />)
.add("undeterminate", () => <Checkbox {...props} indeterminate={true} />)
.add("disabled", () => <Checkbox {...props} disabled={true} />)
.add("interactive", () => (
<Form initial={{ data: false }}>
{({ change, data }) => (
<Checkbox
{...props}
checked={data.data}
// Omit second argument
onChange={() =>
change({
target: {
name: "data",
value: !data.data
}
} as any)
}
/>
)}
</Form>
));