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 { TopBanner } from "./TopBanner";
|
2022-11-15 19:33:59 +00:00
|
|
|
|
|
|
|
|
|
<Meta title="UI/TopBanner" component={TopBanner} />
|
|
|
|
|
|
|
|
|
|
<Title title="TopBanner" suffix="Brief" />
|
|
|
|
|
|
|
|
|
|
## Definition
|
|
|
|
|
|
2023-08-15 00:42:10 +00:00
|
|
|
|
Top banner will be position on the very top of the page to communicate on what’s wrong or what’s new.
|
2022-11-15 19:33:59 +00:00
|
|
|
|
|
|
|
|
|
## Structure
|
2023-08-15 00:42:10 +00:00
|
|
|
|
|
2022-11-15 19:33:59 +00:00
|
|
|
|
Each toast has a state to represent neutral, positive or negative responses.
|
|
|
|
|
|
|
|
|
|
<CustomArgsTable of={TopBanner} />
|
|
|
|
|
|
|
|
|
|
<Examples title="Top Banner Style">
|
2023-08-15 00:42:10 +00:00
|
|
|
|
<Example title="Default" isFullWidth={true}>
|
|
|
|
|
<TopBanner
|
|
|
|
|
actions={
|
|
|
|
|
<button
|
|
|
|
|
className="border-b border-black text-sm"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
console.log("test");
|
|
|
|
|
}}>
|
|
|
|
|
Action
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
text="Something big is happening we want you to know about."
|
|
|
|
|
/>
|
|
|
|
|
</Example>
|
|
|
|
|
<Example title="Warning" isFullWidth={true}>
|
2022-11-15 19:33:59 +00:00
|
|
|
|
<TopBanner
|
2023-08-15 00:42:10 +00:00
|
|
|
|
actions={
|
|
|
|
|
<button
|
|
|
|
|
className="border-b border-black text-sm"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
console.log("test");
|
|
|
|
|
}}>
|
|
|
|
|
Action
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
variant="warning"
|
|
|
|
|
text="An app wide warning is occuring that should be resolved."
|
|
|
|
|
/>
|
|
|
|
|
</Example>
|
|
|
|
|
<Example title="Error" isFullWidth={true}>
|
2022-11-15 19:33:59 +00:00
|
|
|
|
<TopBanner
|
2023-08-15 00:42:10 +00:00
|
|
|
|
actions={
|
|
|
|
|
<button
|
|
|
|
|
className="border-b border-black text-sm"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
console.log("test");
|
|
|
|
|
}}>
|
|
|
|
|
Action
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
variant="error"
|
|
|
|
|
text="A major error is occuring that must be resolved."
|
|
|
|
|
/>
|
|
|
|
|
</Example>
|
2022-11-15 19:33:59 +00:00
|
|
|
|
</Examples>
|
2023-06-23 09:04:26 +00:00
|
|
|
|
|
|
|
|
|
<Canvas>
|
2023-08-15 00:42:10 +00:00
|
|
|
|
<Story
|
|
|
|
|
name="TopBanner"
|
|
|
|
|
args={{
|
|
|
|
|
text: "Something big is happening we want you to know about.",
|
|
|
|
|
variant: "default",
|
|
|
|
|
}}
|
|
|
|
|
argTypes={{
|
|
|
|
|
variant: {
|
|
|
|
|
control: {
|
|
|
|
|
type: "select",
|
|
|
|
|
options: ["default", "warning", "error"],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
text: {
|
|
|
|
|
control: {
|
|
|
|
|
type: "text",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}>
|
2023-06-23 09:04:26 +00:00
|
|
|
|
{({ text, variant, ...args }) => (
|
|
|
|
|
<TopBanner
|
|
|
|
|
{...args}
|
|
|
|
|
actions={
|
|
|
|
|
<button
|
|
|
|
|
className="border-b border-black text-sm"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
alert("test");
|
|
|
|
|
}}>
|
|
|
|
|
Action
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
variant={variant}
|
|
|
|
|
text={text}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</Story>
|
|
|
|
|
</Canvas>
|