2021-08-18 20:08:14 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
import type { Meta } from '@storybook/react';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { PropsType } from './Checkbox';
|
|
|
|
import { Checkbox } from './Checkbox';
|
2021-08-18 20:08:14 +00:00
|
|
|
|
|
|
|
const createProps = (): PropsType => ({
|
|
|
|
checked: false,
|
|
|
|
label: 'Check Me!',
|
|
|
|
name: 'check-me',
|
|
|
|
onChange: action('onChange'),
|
|
|
|
});
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export default {
|
|
|
|
title: 'Components/Checkbox',
|
2023-10-11 19:06:43 +00:00
|
|
|
} satisfies Meta<PropsType>;
|
2021-08-18 20:08:14 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Normal(): JSX.Element {
|
|
|
|
return <Checkbox {...createProps()} />;
|
|
|
|
}
|
|
|
|
export function Checked(): JSX.Element {
|
|
|
|
return <Checkbox {...createProps()} checked />;
|
|
|
|
}
|
2021-08-18 20:08:14 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Description(): JSX.Element {
|
|
|
|
return <Checkbox {...createProps()} description="This is a checkbox" />;
|
|
|
|
}
|
2021-08-18 20:08:14 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function Disabled(): JSX.Element {
|
|
|
|
return <Checkbox {...createProps()} disabled />;
|
|
|
|
}
|