2023-08-15 00:42:10 +00:00
|
|
|
import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
|
|
|
|
|
|
|
|
import {
|
|
|
|
Examples,
|
|
|
|
Example,
|
|
|
|
Note,
|
|
|
|
Title,
|
|
|
|
CustomArgsTable,
|
|
|
|
VariantsTable,
|
|
|
|
VariantRow,
|
|
|
|
} from "@calcom/storybook/components";
|
|
|
|
|
|
|
|
import { Alert } from "./Alert";
|
2023-01-05 12:04:28 +00:00
|
|
|
|
|
|
|
<Meta title="UI/Alert" component={Alert} />
|
|
|
|
|
2023-08-15 00:42:10 +00:00
|
|
|
<Title title="Alert" suffix="Brief" subtitle="Version 2.0 — Last Update: 04 jan 2023" />
|
2023-01-05 12:04:28 +00:00
|
|
|
|
|
|
|
## Definition
|
2023-08-15 00:42:10 +00:00
|
|
|
|
2023-01-05 12:04:28 +00:00
|
|
|
Alerts provide time-based feedback to the user after taking an action.
|
|
|
|
|
|
|
|
## Structure
|
2023-08-15 00:42:10 +00:00
|
|
|
|
2023-01-05 12:04:28 +00:00
|
|
|
Each alert has a state to represent neutral, positive or negative responses.
|
|
|
|
|
|
|
|
<CustomArgsTable of={Alert} />
|
|
|
|
|
|
|
|
<Examples title="Alert style">
|
|
|
|
<Example title="Error">
|
2023-08-15 00:42:10 +00:00
|
|
|
<Alert
|
|
|
|
severity="error"
|
|
|
|
title="Summarise what happened"
|
|
|
|
message="Describe what can be done about it here."
|
|
|
|
/>
|
2023-01-05 12:04:28 +00:00
|
|
|
</Example>
|
|
|
|
<Example title="Warning">
|
2023-08-15 00:42:10 +00:00
|
|
|
<Alert
|
|
|
|
severity="warning"
|
|
|
|
title="Summarise what happened"
|
|
|
|
message="Describe what can be done about it here."
|
|
|
|
/>
|
2023-01-05 12:04:28 +00:00
|
|
|
</Example>
|
|
|
|
<Example title="With actions">
|
|
|
|
<Alert
|
|
|
|
severity="warning"
|
|
|
|
title="Summarise what happened"
|
|
|
|
message="Describe what can be done about it here."
|
2023-08-15 00:42:10 +00:00
|
|
|
actions={
|
|
|
|
<>
|
|
|
|
<button>Cancel me</button>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
2023-01-05 12:04:28 +00:00
|
|
|
</Example>
|
|
|
|
</Examples>
|
|
|
|
|
|
|
|
<Title offset title="Alert" suffix="Variants" />
|
|
|
|
|
|
|
|
<Canvas>
|
|
|
|
<Story
|
2023-06-23 09:04:26 +00:00
|
|
|
name="Alert"
|
|
|
|
args={{
|
2023-08-15 00:42:10 +00:00
|
|
|
severity: "success",
|
|
|
|
title: "Summarise what happened",
|
|
|
|
message: "Describe what can be done about it here.",
|
2023-06-23 09:04:26 +00:00
|
|
|
}}
|
|
|
|
argTypes={{
|
|
|
|
severity: {
|
|
|
|
control: {
|
2023-08-15 00:42:10 +00:00
|
|
|
type: "inline-radio",
|
|
|
|
options: ["success", "warning", "error", "neutral", "info"],
|
2023-06-23 09:04:26 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
control: {
|
2023-08-15 00:42:10 +00:00
|
|
|
type: "text",
|
|
|
|
},
|
2023-06-23 09:04:26 +00:00
|
|
|
},
|
|
|
|
message: {
|
|
|
|
control: {
|
2023-08-15 00:42:10 +00:00
|
|
|
type: "text",
|
|
|
|
},
|
2023-06-23 09:04:26 +00:00
|
|
|
},
|
2023-08-15 00:42:10 +00:00
|
|
|
}}>
|
2023-06-23 09:04:26 +00:00
|
|
|
{({ severity, title, message }) => (
|
2023-08-15 00:42:10 +00:00
|
|
|
<VariantsTable titles={["Default"]} columnMinWidth={150}>
|
2023-06-23 09:04:26 +00:00
|
|
|
<VariantRow variant={severity}>
|
|
|
|
<Alert severity={severity} title={title} message={message} />
|
|
|
|
</VariantRow>
|
|
|
|
</VariantsTable>
|
|
|
|
)}
|
2023-01-05 12:04:28 +00:00
|
|
|
</Story>
|
|
|
|
</Canvas>
|