-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathAlert.stories.tsx
More file actions
91 lines (81 loc) · 2.18 KB
/
Alert.stories.tsx
File metadata and controls
91 lines (81 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import type { Meta, StoryFn } from "@storybook/react";
import { VscodeButton } from "@vscode-elements/react-elements";
import { VariantAnalysisContainer } from "../../view/variant-analysis/VariantAnalysisContainer";
import { Alert } from "../../view/common";
import { Link } from "../../view/common/Link";
export default {
title: "Alert",
component: Alert,
decorators: [
(Story) => (
<VariantAnalysisContainer>
<Story />
</VariantAnalysisContainer>
),
],
} as Meta<typeof Alert>;
const Template: StoryFn<typeof Alert> = (args) => <Alert {...args} />;
export const Warning = Template.bind({});
Warning.args = {
type: "warning",
title: "This query found a warning",
message: (
<>
Warning content with <Link>links</Link>
</>
),
};
export const WarningInverse = Template.bind({});
WarningInverse.args = {
...Warning.args,
message: "Warning content",
inverse: true,
};
export const WarningExample = Template.bind({});
WarningExample.args = {
type: "warning",
title: "Query manually stopped",
message:
"This query was manually stopped before the analysis completed. Results may be partial.",
};
export const Error = Template.bind({});
Error.args = {
type: "error",
title: "This query found an error",
message: (
<>
Error content with <Link>links</Link>
</>
),
};
export const ErrorInverse = Template.bind({});
ErrorInverse.args = {
...Error.args,
message: "Error content",
inverse: true,
};
export const ErrorExample = Template.bind({});
ErrorExample.args = {
type: "error",
title: "Request failed",
message: (
<>
Request to
https://api.github.com/repos/octodemo/Hello-World/code-scanning/codeql/queries
failed. <Link>View actions logs</Link> and try running this query again.
</>
),
};
export const ErrorWithButtons = Template.bind({});
ErrorWithButtons.args = {
type: "error",
title: "Request failed",
message:
"Request to https://api.github.com/repos/octodemo/Hello-World/code-scanning/codeql/queries failed. Try running this query again.",
actions: (
<>
<VscodeButton secondary>View actions logs</VscodeButton>
<VscodeButton>Retry</VscodeButton>
</>
),
};