forked from zoltantothcom/Design-Patterns-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPercentage.stories.js
More file actions
26 lines (22 loc) · 800 Bytes
/
Percentage.stories.js
File metadata and controls
26 lines (22 loc) · 800 Bytes
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
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Percentage } from '../src/components/Percentage';
const initialArray = (n, isAnswered, isCorrect) => {
let arr = Array(...Array(n));
return arr.map((x, i) => {
return {
patternId: null,
answerId: null,
answered: isAnswered,
correct: isCorrect,
uuid: i
};
});
};
const answers0 = initialArray(23, true, false);
const answers50 = [...initialArray(11, true, false), ...initialArray(12, true, true)];
const answers100 = initialArray(23, true, true);
storiesOf('Percentage', module)
.add('under 40', () => <Percentage answers={answers0} />)
.add('between 40 and 70', () => <Percentage answers={answers50} />)
.add('over 70', () => <Percentage answers={answers100} />);