2022-11-03 18:09:09 +01:00
|
|
|
import React from 'react';
|
|
|
|
import {
|
|
|
|
DISPLAY,
|
|
|
|
FLEX_DIRECTION,
|
2023-02-02 21:15:26 +01:00
|
|
|
Color,
|
|
|
|
TextColor,
|
|
|
|
Size,
|
2022-11-03 18:09:09 +01:00
|
|
|
} from '../../../helpers/constants/design-system';
|
|
|
|
|
|
|
|
import Box from '../../ui/box';
|
2022-11-29 22:00:51 +01:00
|
|
|
|
|
|
|
import { Icon, ICON_NAMES } from '..';
|
2022-11-03 18:09:09 +01:00
|
|
|
|
|
|
|
import { HelpText } from './help-text';
|
|
|
|
|
|
|
|
import README from './README.mdx';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/ComponentLibrary/HelpText',
|
2023-01-20 20:27:46 +01:00
|
|
|
|
2022-11-03 18:09:09 +01:00
|
|
|
component: HelpText,
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
page: README,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
children: {
|
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
className: {
|
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
error: {
|
|
|
|
control: 'boolean',
|
|
|
|
},
|
|
|
|
color: {
|
|
|
|
control: 'select',
|
2023-02-02 21:15:26 +01:00
|
|
|
options: Object.values(TextColor),
|
2022-11-03 18:09:09 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
args: {
|
|
|
|
children: 'Help text',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const Template = (args) => <HelpText {...args} />;
|
|
|
|
|
|
|
|
export const DefaultStory = Template.bind({});
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
|
|
|
export const Children = (args) => (
|
|
|
|
<Box display={DISPLAY.FLEX} flexDirection={FLEX_DIRECTION.COLUMN} gap={2}>
|
|
|
|
<HelpText {...args}>Plain text</HelpText>
|
|
|
|
<HelpText {...args}>
|
|
|
|
Text and icon
|
|
|
|
<Icon
|
|
|
|
marginLeft={1}
|
2023-02-02 21:15:26 +01:00
|
|
|
color={Color.inherit}
|
2023-01-24 18:39:46 +01:00
|
|
|
name={ICON_NAMES.WARNING}
|
2023-02-02 21:15:26 +01:00
|
|
|
size={Size.inherit}
|
2022-11-03 18:09:09 +01:00
|
|
|
/>
|
|
|
|
</HelpText>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
|
|
|
|
export const ErrorStory = (args) => (
|
|
|
|
<HelpText error {...args}>
|
|
|
|
This HelpText in error state
|
|
|
|
</HelpText>
|
|
|
|
);
|
|
|
|
ErrorStory.storyName = 'Error';
|
|
|
|
|
2023-02-02 21:15:26 +01:00
|
|
|
export const ColorStory = (args) => (
|
2022-11-03 18:09:09 +01:00
|
|
|
<Box display={DISPLAY.FLEX} flexDirection={FLEX_DIRECTION.COLUMN} gap={2}>
|
2023-02-02 21:15:26 +01:00
|
|
|
<HelpText color={Color.textDefault} {...args}>
|
|
|
|
This HelpText default color is Color.textDefault
|
2022-11-03 18:09:09 +01:00
|
|
|
</HelpText>
|
2023-02-02 21:15:26 +01:00
|
|
|
<HelpText color={Color.infoDefault} {...args}>
|
|
|
|
This HelpText color is Color.infoDefault
|
2022-11-03 18:09:09 +01:00
|
|
|
</HelpText>
|
2023-02-02 21:15:26 +01:00
|
|
|
<HelpText color={Color.warningDefault} {...args}>
|
|
|
|
This HelpText color is Color.warningDefault
|
2022-11-03 18:09:09 +01:00
|
|
|
</HelpText>
|
2023-02-02 21:15:26 +01:00
|
|
|
<HelpText color={Color.successDefault} {...args}>
|
|
|
|
This HelpText color is Color.successDefault
|
2022-11-03 18:09:09 +01:00
|
|
|
</HelpText>
|
|
|
|
</Box>
|
|
|
|
);
|
2023-02-02 21:15:26 +01:00
|
|
|
ColorStory.storyName = 'Color';
|