2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-08-21 22:04:19 +00:00
|
|
|
import * as React from 'react';
|
2023-10-11 19:06:43 +00:00
|
|
|
import type { Meta } from '@storybook/react';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { Props } from './Spinner';
|
|
|
|
import { Spinner, SpinnerDirections, SpinnerSvgSizes } from './Spinner';
|
2020-08-21 22:04:19 +00:00
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export default {
|
|
|
|
title: 'Components/Spinner',
|
2023-10-11 19:06:43 +00:00
|
|
|
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-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 22:04:19 +00:00
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
export function SvgSizes(args: Props): JSX.Element {
|
2022-06-07 00:48:02 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{SpinnerSvgSizes.map(svgSize => (
|
2023-10-11 19:06:43 +00:00
|
|
|
<Spinner key={svgSize} {...args} svgSize={svgSize} />
|
2022-06-07 00:48:02 +00:00
|
|
|
))}
|
|
|
|
</>
|
|
|
|
);
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|
2020-08-21 22:04:19 +00:00
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
export function Directions(args: Props): JSX.Element {
|
2022-06-07 00:48:02 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{SpinnerDirections.map(direction => (
|
2023-10-11 19:06:43 +00:00
|
|
|
<Spinner key={direction} {...args} direction={direction} />
|
2022-06-07 00:48:02 +00:00
|
|
|
))}
|
|
|
|
</>
|
|
|
|
);
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|