import React from 'react';
import { Box, Typography } from '@mui/material';
import { StoryFn, Meta } from '@storybook/react-webpack5';
import Alert from '@/components/Alert';
import Button from '@/components/Button';
import theme from '@/theme';
import { action } from 'storybook/actions';
export default {
title: 'Components/Alert',
component: Alert,
argTypes: {
title: {
control: 'text',
description: 'Used to represent the title of the alert.',
},
severity: {
control: 'radio',
table: {
defaultValue: { summary: 'success' },
},
options: ['success', 'info', 'warning', 'error', undefined],
description: `\`success\`, \`info\`, \`warning\`, \`error\`, \`undefined\``,
},
onClose: {
control: false, // TODO: 스토리북 버전업 과정에서 control 이 'function' 타입을 지원하지 않아 false 로 변경. 현재 스토리북에서 동작은 이상없으나 필요한 사항이 있으면 수정할 것
description: `Callback fired when the component requests to be closed.
When provided, a close icon button is displayed that triggers the callback when clicked.`,
},
},
parameters: {
controls: {
include: ['title', 'severity', 'onClose'],
},
docs: {
description: {
component: `An alert displays a short, important message in a way that attracts the
user's attention without interrupting the user's task.
see [Material-UI Alert](https://mui.com/components/alert/)`,
},
},
},
decorators: [
(Story) => (
{Story()}
),
],
} as Meta;
const AlertChildrenContentLong = () => {
return (
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut{' '}
labore et dolore magna
aliqua. A diam sollicitudin tempor id eu nisl nunc mi. Auctor augue mauris augue neque gravida
in fermentum.
);
};
const AlertChildrenContentShort = () => {
return (
Lorem ipsum dolor sit amet, consectetur adipiscin
);
};
const AlertBottomAction = () => {
return (
);
};
const Template: StoryFn = (args) => (
);
const Template2: StoryFn = (args) => (
<>
{}}>
{}}>
>
);
const Template3: StoryFn = (args) => (
<>
} {...args}>
>
);
export const AlertBase = {
render: Template,
args: {
title: 'Alert title',
severity: 'success',
onClose: action('Close Button is clicked'),
},
};
export const AlertVariant = {
render: Template2,
args: {
title: 'Alert title',
severity: 'success',
onClose: action('Close Button is clicked'),
},
};
export const AlertWithBottomAction = {
render: Template3,
args: {
title: 'Alert title',
severity: 'success',
onClose: action('Close Button is clicked'),
},
};