DocSpace-client/packages/shared/components/toggle-button/toggle-button.stories.tsx

42 lines
917 B
TypeScript
Raw Normal View History

import React, { useState } from "react";
import ToggleButton from "./";
export default {
title: "Components/ToggleButton",
component: ToggleButton,
parameters: {
docs: { description: { component: "Custom toggle button input" } },
},
argTypes: {
onChange: { action: "onChange" },
},
};
2023-11-27 06:58:19 +00:00
const Template = ({
isChecked,
onChange,
...args
}: any) => {
const [value, setValue] = useState(isChecked);
return (
<ToggleButton
{...args}
isChecked={value}
2023-11-27 06:58:19 +00:00
onChange={(e: any) => {
setValue(e.target.checked);
onChange(e);
}}
/>
);
};
export const Default = Template.bind({});
2023-11-27 06:58:19 +00:00
// @ts-expect-error TS(2339): Property 'args' does not exist on type '({ isCheck... Remove this comment to see the full error message
Default.args = {
id: "toggle id",
className: "toggle className",
isDisabled: false,
label: "label text",
isChecked: false,
};