signal-desktop/ts/components/Checkbox.stories.tsx

36 lines
905 B
TypeScript
Raw Normal View History

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';
import type { Meta } from '@storybook/react';
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',
} 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 />;
}