This repository was archived by the owner on Feb 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProgressModal.stories.tsx
142 lines (132 loc) · 3.37 KB
/
ProgressModal.stories.tsx
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
import { ProgressStatus, Step } from "@/types";
import { ProgressModal } from "./ProgressModal";
const meta: Meta<typeof ProgressModal> = {
title: "Components/ProgressModal",
component: ProgressModal,
} satisfies Meta<typeof ProgressModal>;
export default meta;
type Story = StoryObj<typeof ProgressModal>;
const Template: React.FC<{
isOpen?: boolean;
heading?: string;
subheading?: string;
steps: Step[];
}> = (args) => {
return (
<div>
<ProgressModal
isOpen={true}
heading={args.heading}
subheading={args.subheading}
steps={args.steps}
/>
</div>
);
};
export const Default: Story = {
render: (args) => <Template {...args} />,
args: {
isOpen: true,
heading: "Processing Your Request",
subheading: "Please hold while we record your results onchain.",
steps: [
{
name: "INITIALIZED",
description: "Preparing the necessary resources.",
status: ProgressStatus.IS_SUCCESS,
},
{
name: "STORING",
description: "The storing operation is currently in progress.",
status: ProgressStatus.IN_PROGRESS,
},
{
name: "PROCESS",
description: "The operation will start soon.",
status: ProgressStatus.NOT_STARTED,
},
{
name: "FINALIZE",
description: "Wrapping up the last steps.",
status: ProgressStatus.NOT_STARTED,
},
],
},
};
export const AllStepsSuccess: Story = {
render: (args) => <Template {...args} />,
args: {
isOpen: true,
heading: "All Steps Completed",
subheading: "Your operation was successful.",
steps: [
{
name: "INITIALIZED",
description: "Completed successfully.",
status: ProgressStatus.IS_SUCCESS,
},
{
name: "PROCESSED",
description: "Completed successfully.",
status: ProgressStatus.IS_SUCCESS,
},
{
name: "FINILIZED",
description: "Completed successfully.",
status: ProgressStatus.IS_SUCCESS,
},
],
},
};
export const WithError: Story = {
render: (args) => <Template {...args} />,
args: {
isOpen: true,
heading: "An Error Occurred",
subheading: "There was a problem processing your request.",
steps: [
{
name: "INITIALIZING",
description: "Initializing the action",
status: ProgressStatus.IS_SUCCESS,
},
{
name: "FAILED PROCESSING",
description: "Failed to complete.",
status: ProgressStatus.IS_ERROR,
},
{
name: "FINALIZING",
description: "Finalize the action.",
status: ProgressStatus.NOT_STARTED,
},
],
},
};
export const InProgress: Story = {
render: (args) => <Template {...args} />,
args: {
isOpen: true,
heading: "Processing Your Request",
subheading: "Please wait while we complete the operation.",
steps: [
{
name: "INITIALIZING",
description: "Initializing resources.",
status: ProgressStatus.IN_PROGRESS,
},
{
name: "PROCESSING",
description: "Processing data.",
status: ProgressStatus.NOT_STARTED,
},
{
name: "FINALIZING",
description: "Finalizing steps.",
status: ProgressStatus.NOT_STARTED,
},
],
},
};