-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathprogress-bar-modifiers.stories.js
More file actions
143 lines (132 loc) · 2.99 KB
/
Copy pathprogress-bar-modifiers.stories.js
File metadata and controls
143 lines (132 loc) · 2.99 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
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
143
import React from 'react';
import { ProgressBar } from '../lib/react-progress-bar';
export default {
title: 'Components/Progress Bar/Modifiers',
component: ProgressBar,
parameters: {
actions: {
disable: true,
},
controls: {
disable: true,
},
previewTabs: {
'storybook/docs/panel': {
hidden: true,
},
},
},
decorators: [
(Story) => (
<div className="sui-box">
<div className="sui-box-body">
<Story />
</div>
</div>
),
],
};
const Title = ({ children }) => {
const customStyles = {
margin: 0,
marginBottom: 10 + 'px',
color: '#333',
fontSize: 14 + 'px',
lineHeight: 22 + 'px',
};
return <h3 style={customStyles}>{children}</h3>;
};
const Description = ({ children }) => {
const customStyles = {
margin: 0,
marginBottom: 10 + 'px',
};
return (
<p className="sui-description" style={customStyles}>
{children}
</p>
);
};
const Code = ({ spaceTop = 5, spaceBottom = 20, children }) => {
const customStyles = {
display: 'block',
margin: 0,
marginTop: spaceTop + 'px',
marginBottom: spaceBottom + 'px',
padding: 5 + 'px ' + 10 + 'px',
};
return <code style={customStyles}>{children}</code>;
};
const Section = ({
title,
description,
code,
code2,
isDefault = false,
isLast = false,
children,
}) => {
return (
<>
{title && '' !== title && (
<Title>
{title}
{isDefault && (
<span
className="sui-tag sui-tag-sm sui-tag-yellow"
style={{ marginLeft: 10 + 'px' }}
aria-hidden="true"
>
Default
</span>
)}
</Title>
)}
{description && '' !== description && <Description>{description}</Description>}
{code && '' !== code && (
<Code {...(code2 && '' !== code2 && { spaceBottom: 5 })}>{code}</Code>
)}
{code2 && '' !== code2 && <Code>{code2}</Code>}
{children}
{!isLast && <hr />}
</>
);
};
export const Design = () => {
return (
<>
<Section
title="Unboxed"
description="By default, the progress bar is simple and shows all the necessary elements to work."
code="<ProgressBar now={ 30 } />"
isDefault={true}
>
<ProgressBar now={30} />
</Section>
<Section
title="Boxed Simple"
description={
<>
Using the <code style={{ fontSize: 11 }}>hasFrame</code> property, you can display a gray border with inner spacing around the progress bar and its elements.
</>
}
code="<ProgressBar now={ 30 } hasFrame={ true } hasLegend={ false } />"
>
<ProgressBar now={30} hasFrame={true} hasLegend={false} />
</Section>
<Section
title="Boxed with Legend"
description={
<>
The boxed variation can come with a legend at the bottom if necessary that you can display using the <code style={{ fontSize: 11 }}>hasLegend</code> property.
</>
}
code="<ProgressBar now={ 30 } hasFrame={ true } hasLegend={ true } />"
isLast={true}
>
<ProgressBar now={30} hasFrame={true} hasLegend={true} />
</Section>
</>
);
};
Design.storyName = 'By Design';