forked from zoltantothcom/Design-Patterns-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgressBar.stories.js
More file actions
26 lines (22 loc) · 854 Bytes
/
ProgressBar.stories.js
File metadata and controls
26 lines (22 loc) · 854 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 { ProgressBar } from '../src/components/ProgressBar';
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 answersDefault = initialArray(23);
const answersSuccess = initialArray(23, true, true);
const answersError = initialArray(23, true, false);
storiesOf('ProgressBar', module)
.add('unanswered questions', () => <ProgressBar answers={[]} remaining={answersDefault} />)
.add('all questions correct', () => <ProgressBar answers={answersSuccess} remaining={[]} />)
.add('all questions wrong', () => <ProgressBar answers={answersError} remaining={[]} />);