mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-19 17:58:48 +00:00
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
// Copyright 2025 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
import React, { useState } from 'react';
|
|
import type { Meta } from '@storybook/react';
|
|
import { AxoSwitch } from './AxoSwitch';
|
|
import { tw } from './tw';
|
|
|
|
export default {
|
|
title: 'Axo/AxoSwitch',
|
|
} satisfies Meta;
|
|
|
|
function Template(props: {
|
|
label: string;
|
|
defaultChecked: boolean;
|
|
disabled?: boolean;
|
|
}): JSX.Element {
|
|
const [checked, setChecked] = useState(props.defaultChecked);
|
|
return (
|
|
<label className={tw('my-2 flex items-center gap-2')}>
|
|
<AxoSwitch
|
|
checked={checked}
|
|
onCheckedChange={setChecked}
|
|
disabled={props.disabled}
|
|
/>
|
|
{props.label}
|
|
</label>
|
|
);
|
|
}
|
|
|
|
export function Basic(): JSX.Element {
|
|
return (
|
|
<>
|
|
<h1 className={tw('type-title-large')}>AxoSwitch</h1>
|
|
<Template label="Unchecked" defaultChecked={false} />
|
|
<Template label="Checked" defaultChecked />
|
|
<Template label="UncheckedDisabled" defaultChecked={false} disabled />
|
|
<Template label="CheckedDisabled" defaultChecked disabled />
|
|
</>
|
|
);
|
|
}
|