Skip to content

Commit a3304c9

Browse files
committed
Update stories.
1 parent 8ce906e commit a3304c9

File tree

2 files changed

+135
-76
lines changed

2 files changed

+135
-76
lines changed

stories/canvas-renderer.js

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -28,61 +28,61 @@ canvasRendererStories.addWithJSX('The kitchen sink', () => {
2828
const displayGroup = 'Display options';
2929
const progressGroup = 'Progress display options';
3030
return (
31-
<CanvasRenderer
32-
width={200}
33-
height={200}
34-
steps={number(
35-
'steps',
36-
10,
37-
{
38-
range: true,
39-
min: 5,
40-
max: 12,
41-
step: 1,
42-
},
43-
progressGroup
44-
)}
45-
proportion={number(
46-
'proportion',
47-
0.55,
48-
{
49-
range: true,
50-
min: 0,
51-
max: 1,
52-
step: 1 / 500,
53-
},
54-
progressGroup
55-
)}
56-
showIntermediateProgress={boolean(
57-
'showIntermediateProgress',
58-
true,
59-
progressGroup
60-
)}
61-
segmented={boolean('segmented', true, displayGroup)}
62-
ringBgColour={color('ringBgColour', '#ccc', coloursGroup)}
63-
ringIntermediateColour={color(
64-
'ringIntermediateColour',
65-
'#aaa',
66-
coloursGroup
67-
)}
68-
ringFgColour={color('ringFgColour', '#000', coloursGroup)}
69-
backgroundColour={color('backgroundColour', '#fff', coloursGroup)}
70-
backgroundTransparent={boolean(
71-
'backgroundTransparent',
72-
true,
73-
coloursGroup
74-
)}
75-
ringThickness={number(
76-
'ringThickness',
77-
0.2,
78-
{
79-
range: true,
80-
min: 0,
81-
max: 0.5,
82-
step: 1 / 100,
83-
},
84-
displayGroup
85-
)}
86-
/>
31+
<div style={{ width: 200, height: 200 }}>
32+
<CanvasRenderer
33+
steps={number(
34+
'steps',
35+
10,
36+
{
37+
range: true,
38+
min: 5,
39+
max: 12,
40+
step: 1,
41+
},
42+
progressGroup
43+
)}
44+
proportion={number(
45+
'proportion',
46+
0.55,
47+
{
48+
range: true,
49+
min: 0,
50+
max: 1,
51+
step: 1 / 500,
52+
},
53+
progressGroup
54+
)}
55+
showIntermediateProgress={boolean(
56+
'showIntermediateProgress',
57+
true,
58+
progressGroup
59+
)}
60+
segmented={boolean('segmented', true, displayGroup)}
61+
ringBgColour={color('ringBgColour', '#ccc', coloursGroup)}
62+
ringIntermediateColour={color(
63+
'ringIntermediateColour',
64+
'#aaa',
65+
coloursGroup
66+
)}
67+
ringFgColour={color('ringFgColour', '#000', coloursGroup)}
68+
backgroundColour={color('backgroundColour', '#fff', coloursGroup)}
69+
backgroundTransparent={boolean(
70+
'backgroundTransparent',
71+
true,
72+
coloursGroup
73+
)}
74+
ringThickness={number(
75+
'ringThickness',
76+
0.2,
77+
{
78+
range: true,
79+
min: 0,
80+
max: 0.5,
81+
step: 1 / 100,
82+
},
83+
displayGroup
84+
)}
85+
/>
86+
</div>
8787
);
8888
});

stories/index.js

Lines changed: 79 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ const stories = storiesOf('RadialProgress', module);
1616

1717
stories.addDecorator(myBackgrounds);
1818

19+
stories.addDecorator(story => (
20+
<div style={{ textAlign: 'center', fontFamily: 'Helvetica, sans-serif' }}>
21+
{story()}
22+
</div>
23+
));
24+
1925
stories
2026
.addWithJSX('At 3/10', () => (
2127
<RadialProgress
@@ -27,14 +33,16 @@ stories
2733
/>
2834
))
2935
.addWithJSX('At 3/10, thin ring', () => (
30-
<RadialProgress
31-
startStep={3}
32-
step={3}
33-
steps={10}
34-
width={200}
35-
height={200}
36-
ringThickness={0.05}
37-
/>
36+
<div style={{ fontWeight: 100 }}>
37+
<RadialProgress
38+
startStep={3}
39+
step={3}
40+
steps={10}
41+
width={200}
42+
height={200}
43+
ringThickness={0.05}
44+
/>
45+
</div>
3846
))
3947
.addWithJSX('At 3/10, thick ring', () => (
4048
<RadialProgress
@@ -110,19 +118,17 @@ stories
110118
/>
111119
))
112120
.addWithJSX('Custom text', () => (
113-
<div style={{ fontFamily: 'sans-serif' }}>
114-
<RadialProgress
115-
steps={5}
116-
step={5}
117-
width={200}
118-
height={200}
119-
showIntermediateProgress={true}
120-
text={(steps, proportion) => `${Math.floor(proportion * 100)}%`}
121-
/>
122-
</div>
121+
<RadialProgress
122+
steps={5}
123+
step={5}
124+
width={200}
125+
height={200}
126+
showIntermediateProgress={true}
127+
text={(steps, proportion) => `${Math.floor(proportion * 100)}%`}
128+
/>
123129
))
124130
.addWithJSX('Small, with custom text', () => (
125-
<div style={{ fontWeight: 'bold', fontFamily: 'sans-serif' }}>
131+
<div style={{ fontWeight: 'bold' }}>
126132
<RadialProgress
127133
steps={6}
128134
step={6}
@@ -133,4 +139,57 @@ stories
133139
text={(steps, proportion) => `${Math.floor(steps * proportion)}`}
134140
/>
135141
</div>
136-
));
142+
))
143+
.addWithJSX('Sized to fit container', () => {
144+
const progress = (
145+
<RadialProgress step={10} steps={10} width="100%" height="100%" />
146+
);
147+
return (
148+
<div>
149+
<div
150+
style={{
151+
float: 'left',
152+
backgroundColor: '#eee',
153+
margin: 5,
154+
width: 50,
155+
height: 200,
156+
}}
157+
>
158+
{progress}
159+
</div>
160+
<div
161+
style={{
162+
float: 'left',
163+
backgroundColor: '#eee',
164+
margin: 5,
165+
width: 100,
166+
height: 200,
167+
}}
168+
>
169+
{progress}
170+
</div>
171+
<div
172+
style={{
173+
float: 'left',
174+
backgroundColor: '#eee',
175+
margin: 5,
176+
width: 200,
177+
height: 200,
178+
}}
179+
>
180+
{progress}
181+
</div>
182+
<div
183+
style={{
184+
float: 'left',
185+
backgroundColor: '#eee',
186+
margin: 5,
187+
width: 200,
188+
height: 100,
189+
}}
190+
>
191+
{progress}
192+
</div>
193+
</div>
194+
);
195+
});

0 commit comments

Comments
 (0)