diff --git a/package.json b/package.json index 8b9d4aa..83acd20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bbodek-ui", - "version": "0.0.181", + "version": "0.0.183", "type": "module", "author": "Bbodek", "license": "MIT", diff --git a/src/core/components/Toggle/Toggle.stories.tsx b/src/core/components/Toggle/Toggle.stories.tsx new file mode 100644 index 0000000..1a14c61 --- /dev/null +++ b/src/core/components/Toggle/Toggle.stories.tsx @@ -0,0 +1,36 @@ +import { Meta } from "@storybook/react"; + +import Toggle from "../Toggle/index"; +import { ToggleButtonProps } from "./types"; + +const meta = { + title: "core/Toggle", + component: Toggle, + tags: ["autodocs"], + argTypes: { + label: { + control: "text", + description: "Toggle Label", + }, + className: { + control: "text", + description: "Toggle ClassName", + }, + checked: { + control: "boolean", + description: "Toggle Checked", + }, + reverse: { + control: "boolean", + description: "Toggle Reverse", + }, + }, +} satisfies Meta; + +export default meta; + +export const Default = (props: ToggleButtonProps) => { + const { label, ...rest } = props; + + return ; +}; diff --git a/src/core/components/Toggle/index.tsx b/src/core/components/Toggle/index.tsx new file mode 100644 index 0000000..7f5486d --- /dev/null +++ b/src/core/components/Toggle/index.tsx @@ -0,0 +1,41 @@ +import clsx from "clsx"; +import { useId } from "react"; + +import Typography from "../Typography"; +import { ToggleButtonProps } from "./types"; + +const ToggleButton = ({ + label, + className, + onChange, + checked, + reverse = false, +}: ToggleButtonProps) => { + const id = useId(); + + return ( +
+ +