2019-06-05 08:54:09 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import withReadme from 'storybook-readme/with-readme';
|
|
|
|
import styled from '@emotion/styled';
|
2019-06-27 13:23:32 +00:00
|
|
|
import { withKnobs, select, color, boolean } from '@storybook/addon-knobs/react';
|
2019-06-05 08:54:09 +00:00
|
|
|
import Readme from './README.md';
|
|
|
|
|
2019-06-05 11:09:38 +00:00
|
|
|
import {Icons} from 'asc-web-components';
|
2019-06-05 08:54:09 +00:00
|
|
|
|
|
|
|
const IconList = styled.div`
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const IconItem = styled.div`
|
|
|
|
padding: 16px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
flex: 1;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const IconContainer = styled.div`
|
|
|
|
margin: 16px 0;
|
|
|
|
`;
|
|
|
|
|
2019-06-05 11:09:38 +00:00
|
|
|
const iconNames = Object.keys(Icons);
|
2019-06-05 08:54:09 +00:00
|
|
|
|
|
|
|
storiesOf('Components|Icons', module)
|
|
|
|
.addDecorator(withKnobs)
|
|
|
|
.addDecorator(withReadme(Readme))
|
2019-06-05 11:09:38 +00:00
|
|
|
.add('all icons', () => (
|
2019-06-05 08:54:09 +00:00
|
|
|
<IconList>
|
2019-06-05 11:09:38 +00:00
|
|
|
{Object.values(Icons).map((Icon, index) => {
|
2019-06-05 11:28:02 +00:00
|
|
|
const sizeValue = select('size', ['small', 'medium', 'big', 'scale'], 'big');
|
2019-06-27 13:23:32 +00:00
|
|
|
|
|
|
|
let isFill = boolean('isfill', false);
|
|
|
|
let iconColor = isFill ? {color: `${color('color', "dimgray")}`} : {};
|
|
|
|
|
2019-07-31 13:35:46 +00:00
|
|
|
let isStroke = boolean('isStroke', false);
|
|
|
|
let iconStroke = isStroke ? {stroke: `${color('stroke', "dimgray")}`} : {};
|
|
|
|
|
2019-06-05 11:28:02 +00:00
|
|
|
const containerWidth =
|
|
|
|
sizeValue === 'scale'
|
|
|
|
? {
|
|
|
|
width: `${select('container width', ['100', '200', '300', '400'], '100')}px`,
|
|
|
|
}
|
|
|
|
: {};
|
2019-06-05 11:09:38 +00:00
|
|
|
return (
|
|
|
|
<IconItem key={index}>
|
2019-06-05 11:28:02 +00:00
|
|
|
<IconContainer style={containerWidth}>
|
2019-06-05 11:09:38 +00:00
|
|
|
<Icon
|
2019-06-27 13:23:32 +00:00
|
|
|
isfill={isFill}
|
2019-07-31 13:35:46 +00:00
|
|
|
isStroke={isStroke}
|
2019-06-05 11:28:02 +00:00
|
|
|
size={sizeValue}
|
2019-06-27 13:23:32 +00:00
|
|
|
{...iconColor}
|
2019-07-31 13:35:46 +00:00
|
|
|
{...iconStroke}
|
2019-06-05 11:09:38 +00:00
|
|
|
/>
|
|
|
|
</IconContainer>
|
|
|
|
<span>{iconNames[index]}</span>
|
|
|
|
</IconItem>
|
|
|
|
);
|
|
|
|
})}
|
2019-06-05 08:54:09 +00:00
|
|
|
</IconList>
|
|
|
|
));
|