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

46 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-10-30 15:34:04 -05:00
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2020-08-21 15:04:19 -07:00
import * as React from 'react';
import type { Meta } from '@storybook/react';
import type { Props } from './Spinner';
import { Spinner, SpinnerDirections, SpinnerSvgSizes } from './Spinner';
2020-08-21 15:04:19 -07:00
2022-06-06 20:48:02 -04:00
export default {
title: 'Components/Spinner',
argTypes: {
size: { control: { type: 'text' } },
svgSize: { control: { type: 'select' }, options: SpinnerSvgSizes },
direction: { control: { type: 'select' }, options: SpinnerDirections },
},
args: {
size: '20px',
svgSize: 'normal',
direction: undefined,
},
} satisfies Meta<Props>;
export function Normal(args: Props): JSX.Element {
return <Spinner {...args} />;
2022-11-17 16:45:19 -08:00
}
2020-08-21 15:04:19 -07:00
export function SvgSizes(args: Props): JSX.Element {
2022-06-06 20:48:02 -04:00
return (
<>
{SpinnerSvgSizes.map(svgSize => (
<Spinner key={svgSize} {...args} svgSize={svgSize} />
2022-06-06 20:48:02 -04:00
))}
</>
);
2022-11-17 16:45:19 -08:00
}
2020-08-21 15:04:19 -07:00
export function Directions(args: Props): JSX.Element {
2022-06-06 20:48:02 -04:00
return (
<>
{SpinnerDirections.map(direction => (
<Spinner key={direction} {...args} direction={direction} />
2022-06-06 20:48:02 -04:00
))}
</>
);
2022-11-17 16:45:19 -08:00
}