import React from "react"; import RadioButton from "../app/components/RadioButton"; import { DefaultInteraction, CheckedInteraction, StandardInteraction, InverseInteraction, } from "../tests/storybook/RadioButton.interactions.test"; const meta = { title: "Forms/RadioButton", component: RadioButton, parameters: { layout: "centered", backgrounds: { default: "dark", values: [{ name: "dark", value: "black" }], }, }, tags: ["autodocs"], argTypes: { checked: { control: "boolean" }, mode: { control: { type: "select" }, options: ["standard", "inverse"], }, state: { control: { type: "select" }, options: ["default", "hover", "focus"], }, label: { control: "text" }, }, args: { checked: false, mode: "standard", state: "default", label: "Radio Button Label", }, }; export default meta; export const Default = { args: { checked: false, mode: "standard", state: "default", label: "Default radio button", }, play: DefaultInteraction.play, render: (args) => { const [checked, setChecked] = React.useState(args.checked); return ( setChecked(newChecked)} /> ); }, }; export const Checked = { args: { checked: true, mode: "standard", state: "default", label: "Checked radio button", }, play: CheckedInteraction.play, render: (args) => { const [checked, setChecked] = React.useState(args.checked); return ( setChecked(newChecked)} /> ); }, }; export const Standard = { render: () => { const [selectedValue, setSelectedValue] = React.useState("checked"); return (

Standard Mode

{ if (checked) setSelectedValue("unchecked"); }} /> { if (checked) setSelectedValue("checked"); }} />
); }, play: StandardInteraction.play, }; export const Inverse = { render: () => { const [selectedValue, setSelectedValue] = React.useState("checked"); return (

Inverse Mode

{ if (checked) setSelectedValue("unchecked"); }} /> { if (checked) setSelectedValue("checked"); }} />
); }, play: InverseInteraction.play, };