This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathIcon.storiesHelpers.js
114 lines (104 loc) · 2.17 KB
/
Icon.storiesHelpers.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import React from 'react'
import styled from 'styled-components'
import { getColor } from '../../styles/utilities/color'
import { boolean, select } from '@storybook/addon-knobs'
import iconList from './icons'
import { Icon, Text } from '../'
const IconGrid = styled('div')`
display: flex;
flex-wrap: wrap;
`
const WrapperUI = styled('div')`
flex: 0 0 80px;
text-align: center;
margin: 12px;
border: 1px solid ${getColor('grey.500')};
border-radius: 5px;
-webkit-box-align: start;
display: flex;
flex-direction: column;
`
const IconContainerUI = styled.div`
display: inline-block;
&:hover {
border: 1px solid ${getColor('grey.400')};
border-radius: 3px;
}
`
const TextWrapper = styled(Text)`
margin-top: 'auto';
border-top: 1px solid ${getColor('grey.500')};
display: 'flex';
padding: 8px;
width: 100%;
color: ${getColor('charcoal.300')};
`
const IconWrapper = styled('div')`
height: 60px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
`
export const Icons = () => {
const size = select(
'size',
{
10: 10,
12: 12,
13: 13,
14: 14,
16: 16,
18: 18,
20: 20,
24: 24,
32: 32,
48: 48,
52: 52,
},
24
)
const state = select(
'state',
{
default: 'default',
error: 'error',
success: 'success',
warning: 'warning',
},
'default'
)
const shade = select(
'shade',
{
default: 'default',
subtle: 'subtle',
muted: 'muted',
faint: 'faint',
extraMuted: 'extraMuted',
},
'default'
)
const muted = boolean('muted', false)
const withCaret = boolean('withCaret', false)
const icons = Object.keys(iconList).map(i => (
<WrapperUI key={i}>
<IconWrapper>
<IconContainerUI>
<Icon
name={i}
key={i}
size={size}
center
state={state}
shade={shade}
muted={muted}
withCaret={withCaret}
/>
</IconContainerUI>
</IconWrapper>
<TextWrapper size="12">{i}</TextWrapper>
</WrapperUI>
))
return <IconGrid>{icons}</IconGrid>
}