Skip to content

Commit fd265ff

Browse files
authored
Loader (#117)
Add Loader
1 parent f441f85 commit fd265ff

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

src/Busy/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import PropTypes from 'prop-types';
2+
import React from 'react';
3+
4+
// Storybook story lives in /Progress folder
5+
const Busy = ({ className, children, ...rest }) => {
6+
return <hx-busy class={className} {...rest}></hx-busy>;
7+
};
8+
9+
Busy.propTypes = {
10+
paused: PropTypes.bool,
11+
className: PropTypes.string,
12+
};
13+
14+
export default Busy;

src/Progress/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import PropTypes from 'prop-types';
2+
import React from 'react';
3+
import classnames from 'classnames';
4+
import useEventListener from '../hooks/useEventListener';
5+
6+
const Progress = ({ className, children, value, ...rest }) => {
7+
return <hx-progress class={className} {...rest} value={value.toString()}></hx-progress>;
8+
};
9+
10+
Progress.propTypes = {
11+
value: PropTypes.number,
12+
className: PropTypes.string,
13+
};
14+
15+
export default Progress;

src/Progress/stories.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import { boolean, number } from '@storybook/addon-knobs/react';
3+
import { storiesOf } from '@storybook/react';
4+
import Busy from '../Busy';
5+
import Progress from './index';
6+
7+
storiesOf('Loader', module)
8+
.add('Busy', () => {
9+
let paused = boolean('paused', false);
10+
return <Busy {...(paused && { paused })} />;
11+
})
12+
.add('Progress', () => {
13+
const options = {
14+
range: true,
15+
min: 0,
16+
max: 100,
17+
step: 1,
18+
};
19+
let value = number('value', 40, options);
20+
return <Progress value={value.toString()} />;
21+
});

src/index.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* Export helix-react definition */
22
import Alert from './Alert';
33
import Button from './Button';
4+
import Busy from './Busy';
45
import Checkbox from './Checkbox';
56
import ChoiceTile from './ChoiceTile';
67
import Disclosure from './Disclosure';
@@ -9,6 +10,7 @@ import Drawer from './Drawer';
910
import Icon from './Icon';
1011
import Modal from './Modal';
1112
import Pill from './Pill';
13+
import Progress from './Progress';
1214
import Status from './Pill/Status';
1315
import Popover from './Popover';
1416
import Radio from './Radio';
@@ -24,6 +26,7 @@ import Tooltip from './Tooltip';
2426
export {
2527
Alert,
2628
Button,
29+
Busy,
2730
Checkbox,
2831
ChoiceTile,
2932
Disclosure,
@@ -33,6 +36,7 @@ export {
3336
Modal,
3437
Pill,
3538
Popover,
39+
Progress,
3640
Radio,
3741
RadioSet,
3842
Search,

0 commit comments

Comments
 (0)