w-design-system 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +19 -0
- package/.storybook/preview.ts +14 -0
- package/README.md +46 -0
- package/README.old.md +1 -0
- package/dist/App.d.ts +5 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +9 -0
- package/dist/App.js.map +1 -0
- package/dist/App.test.d.ts +2 -0
- package/dist/App.test.d.ts.map +1 -0
- package/dist/App.test.js +9 -0
- package/dist/App.test.js.map +1 -0
- package/dist/assets/icon/index.d.ts +7 -0
- package/dist/assets/icon/index.d.ts.map +1 -0
- package/dist/assets/icon/index.js +7 -0
- package/dist/assets/icon/index.js.map +1 -0
- package/dist/components/Banner/index.d.ts +5 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +33 -0
- package/dist/components/Banner/index.js.map +1 -0
- package/dist/components/Banner/stories.d.ts +7 -0
- package/dist/components/Banner/stories.d.ts.map +1 -0
- package/dist/components/Banner/stories.js +25 -0
- package/dist/components/Banner/stories.js.map +1 -0
- package/dist/components/Banner/styles.d.ts +4 -0
- package/dist/components/Banner/styles.d.ts.map +1 -0
- package/dist/components/Banner/styles.js +55 -0
- package/dist/components/Banner/styles.js.map +1 -0
- package/dist/components/Button /index.d.ts +5 -0
- package/dist/components/Button /index.d.ts.map +1 -0
- package/dist/components/Button /index.js +22 -0
- package/dist/components/Button /index.js.map +1 -0
- package/dist/components/Button /stories.d.ts +14 -0
- package/dist/components/Button /stories.d.ts.map +1 -0
- package/dist/components/Button /stories.js +88 -0
- package/dist/components/Button /stories.js.map +1 -0
- package/dist/components/Button /styles.d.ts +4 -0
- package/dist/components/Button /styles.d.ts.map +1 -0
- package/dist/components/Button /styles.js +194 -0
- package/dist/components/Button /styles.js.map +1 -0
- package/dist/components/Button /test.d.ts +2 -0
- package/dist/components/Button /test.d.ts.map +1 -0
- package/dist/components/Button /test.js +33 -0
- package/dist/components/Button /test.js.map +1 -0
- package/dist/components/ButtonRadiusIcon/index.d.ts +5 -0
- package/dist/components/ButtonRadiusIcon/index.d.ts.map +1 -0
- package/dist/components/ButtonRadiusIcon/index.js +26 -0
- package/dist/components/ButtonRadiusIcon/index.js.map +1 -0
- package/dist/components/ButtonRadiusIcon/stories.d.ts +8 -0
- package/dist/components/ButtonRadiusIcon/stories.d.ts.map +1 -0
- package/dist/components/ButtonRadiusIcon/stories.js +42 -0
- package/dist/components/ButtonRadiusIcon/stories.js.map +1 -0
- package/dist/components/ButtonRadiusIcon/styles.d.ts +4 -0
- package/dist/components/ButtonRadiusIcon/styles.d.ts.map +1 -0
- package/dist/components/ButtonRadiusIcon/styles.js +137 -0
- package/dist/components/ButtonRadiusIcon/styles.js.map +1 -0
- package/dist/components/ButtonRound/index.d.ts +5 -0
- package/dist/components/ButtonRound/index.d.ts.map +1 -0
- package/dist/components/ButtonRound/index.js +22 -0
- package/dist/components/ButtonRound/index.js.map +1 -0
- package/dist/components/ButtonRound/stories.d.ts +8 -0
- package/dist/components/ButtonRound/stories.d.ts.map +1 -0
- package/dist/components/ButtonRound/stories.js +44 -0
- package/dist/components/ButtonRound/stories.js.map +1 -0
- package/dist/components/ButtonRound/styles.d.ts +4 -0
- package/dist/components/ButtonRound/styles.d.ts.map +1 -0
- package/dist/components/ButtonRound/styles.js +134 -0
- package/dist/components/ButtonRound/styles.js.map +1 -0
- package/dist/components/IconWrapper/index.d.ts +12 -0
- package/dist/components/IconWrapper/index.d.ts.map +1 -0
- package/dist/components/IconWrapper/index.js +24 -0
- package/dist/components/IconWrapper/index.js.map +1 -0
- package/dist/components/Modal/index.d.ts +5 -0
- package/dist/components/Modal/index.d.ts.map +1 -0
- package/dist/components/Modal/index.js +32 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/stories.d.ts +7 -0
- package/dist/components/Modal/stories.d.ts.map +1 -0
- package/dist/components/Modal/stories.js +24 -0
- package/dist/components/Modal/stories.js.map +1 -0
- package/dist/components/Modal/styles.d.ts +4 -0
- package/dist/components/Modal/styles.d.ts.map +1 -0
- package/dist/components/Modal/styles.js +48 -0
- package/dist/components/Modal/styles.js.map +1 -0
- package/dist/components/Paragraph/index.d.ts +11 -0
- package/dist/components/Paragraph/index.d.ts.map +1 -0
- package/dist/components/Paragraph/index.js +28 -0
- package/dist/components/Paragraph/index.js.map +1 -0
- package/dist/components/Paragraph/stories.d.ts +14 -0
- package/dist/components/Paragraph/stories.d.ts.map +1 -0
- package/dist/components/Paragraph/stories.js +95 -0
- package/dist/components/Paragraph/stories.js.map +1 -0
- package/dist/components/Tabs/index.d.ts +5 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.js +14 -0
- package/dist/components/Tabs/index.js.map +1 -0
- package/dist/components/Tabs/stories.d.ts +7 -0
- package/dist/components/Tabs/stories.d.ts.map +1 -0
- package/dist/components/Tabs/stories.js +31 -0
- package/dist/components/Tabs/stories.js.map +1 -0
- package/dist/components/Tabs/styles.d.ts +6 -0
- package/dist/components/Tabs/styles.d.ts.map +1 -0
- package/dist/components/Tabs/styles.js +22 -0
- package/dist/components/Tabs/styles.js.map +1 -0
- package/dist/components/Themes/index.d.ts +79 -0
- package/dist/components/Themes/index.d.ts.map +1 -0
- package/dist/components/Themes/index.js +83 -0
- package/dist/components/Themes/index.js.map +1 -0
- package/dist/components/Title/index.d.ts +11 -0
- package/dist/components/Title/index.d.ts.map +1 -0
- package/dist/components/Title/index.js +18 -0
- package/dist/components/Title/index.js.map +1 -0
- package/dist/components/Title/stories.d.ts +9 -0
- package/dist/components/Title/stories.d.ts.map +1 -0
- package/dist/components/Title/stories.js +61 -0
- package/dist/components/Title/stories.js.map +1 -0
- package/dist/components/Types/index.d.ts +41 -0
- package/dist/components/Types/index.d.ts.map +1 -0
- package/dist/components/Types/index.js +2 -0
- package/dist/components/Types/index.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/prettier.config.d.ts +10 -0
- package/dist/prettier.config.d.ts.map +1 -0
- package/dist/prettier.config.js +13 -0
- package/dist/prettier.config.js.map +1 -0
- package/dist/reportWebVitals.d.ts +4 -0
- package/dist/reportWebVitals.d.ts.map +1 -0
- package/dist/reportWebVitals.js +14 -0
- package/dist/reportWebVitals.js.map +1 -0
- package/dist/setupTests.d.ts +2 -0
- package/dist/setupTests.d.ts.map +1 -0
- package/dist/setupTests.js +6 -0
- package/dist/setupTests.js.map +1 -0
- package/dist/src/globalStyles.d.ts +4 -0
- package/dist/src/globalStyles.d.ts.map +1 -0
- package/dist/src/globalStyles.js +10 -0
- package/dist/src/globalStyles.js.map +1 -0
- package/dist/stories/Button.d.ts +29 -0
- package/dist/stories/Button.d.ts.map +1 -0
- package/dist/stories/Button.js +22 -0
- package/dist/stories/Button.js.map +1 -0
- package/dist/stories/Button.stories.d.ts +25 -0
- package/dist/stories/Button.stories.d.ts.map +1 -0
- package/dist/stories/Button.stories.js +45 -0
- package/dist/stories/Button.stories.js.map +1 -0
- package/dist/stories/Header.d.ts +14 -0
- package/dist/stories/Header.d.ts.map +1 -0
- package/dist/stories/Header.js +21 -0
- package/dist/stories/Header.js.map +1 -0
- package/dist/stories/Header.stories.d.ts +20 -0
- package/dist/stories/Header.stories.d.ts.map +1 -0
- package/dist/stories/Header.stories.js +27 -0
- package/dist/stories/Header.stories.js.map +1 -0
- package/dist/stories/Page.d.ts +4 -0
- package/dist/stories/Page.d.ts.map +1 -0
- package/dist/stories/Page.js +38 -0
- package/dist/stories/Page.js.map +1 -0
- package/dist/stories/Page.stories.d.ts +14 -0
- package/dist/stories/Page.stories.d.ts.map +1 -0
- package/dist/stories/Page.stories.js +34 -0
- package/dist/stories/Page.stories.js.map +1 -0
- package/dist/types/App.d.ts +4 -0
- package/dist/types/App.test.d.ts +1 -0
- package/dist/types/assets/icon/index.d.ts +6 -0
- package/dist/types/components/Banner/index.d.ts +4 -0
- package/dist/types/components/Banner/stories.d.ts +6 -0
- package/dist/types/components/Banner/styles.d.ts +3 -0
- package/dist/types/components/Button /index.d.ts +4 -0
- package/dist/types/components/Button /stories.d.ts +13 -0
- package/dist/types/components/Button /styles.d.ts +3 -0
- package/dist/types/components/Button /test.d.ts +1 -0
- package/dist/types/components/ButtonRadiusIcon/index.d.ts +4 -0
- package/dist/types/components/ButtonRadiusIcon/stories.d.ts +7 -0
- package/dist/types/components/ButtonRadiusIcon/styles.d.ts +3 -0
- package/dist/types/components/ButtonRound/index.d.ts +4 -0
- package/dist/types/components/ButtonRound/stories.d.ts +7 -0
- package/dist/types/components/ButtonRound/styles.d.ts +3 -0
- package/dist/types/components/IconWrapper/index.d.ts +11 -0
- package/dist/types/components/Modal/index.d.ts +4 -0
- package/dist/types/components/Modal/stories.d.ts +6 -0
- package/dist/types/components/Modal/styles.d.ts +3 -0
- package/dist/types/components/Paragraph/index.d.ts +10 -0
- package/dist/types/components/Paragraph/stories.d.ts +13 -0
- package/dist/types/components/Tabs/index.d.ts +4 -0
- package/dist/types/components/Tabs/stories.d.ts +6 -0
- package/dist/types/components/Tabs/styles.d.ts +5 -0
- package/dist/types/components/Themes/index.d.ts +78 -0
- package/dist/types/components/Title/index.d.ts +10 -0
- package/dist/types/components/Title/stories.d.ts +8 -0
- package/dist/types/components/Types/index.d.ts +40 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/reportWebVitals.d.ts +3 -0
- package/dist/types/setupTests.d.ts +1 -0
- package/dist/types/src/globalStyles.d.ts +3 -0
- package/dist/types/stories/Button.d.ts +28 -0
- package/dist/types/stories/Button.stories.d.ts +24 -0
- package/dist/types/stories/Header.d.ts +13 -0
- package/dist/types/stories/Header.stories.d.ts +19 -0
- package/dist/types/stories/Page.d.ts +3 -0
- package/dist/types/stories/Page.stories.d.ts +13 -0
- package/dist/types/utils/constanst.d.ts +2 -0
- package/dist/utils/constanst.d.ts +3 -0
- package/dist/utils/constanst.d.ts.map +1 -0
- package/dist/utils/constanst.js +3 -0
- package/dist/utils/constanst.js.map +1 -0
- package/package.json +69 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/App.css +39 -0
- package/src/App.test.tsx +9 -0
- package/src/App.tsx +14 -0
- package/src/assets/icon/alert.svg +3 -0
- package/src/assets/icon/close.svg +10 -0
- package/src/assets/icon/comment.svg +10 -0
- package/src/assets/icon/doc-check.svg +10 -0
- package/src/assets/icon/image.svg +3 -0
- package/src/assets/icon/index.ts +6 -0
- package/src/assets/icon/svg.d.ts +4 -0
- package/src/components/Banner/index.tsx +49 -0
- package/src/components/Banner/stories.tsx +31 -0
- package/src/components/Banner/styles.ts +58 -0
- package/src/components/Button /index.tsx +33 -0
- package/src/components/Button /stories.tsx +98 -0
- package/src/components/Button /styles.ts +198 -0
- package/src/components/Button /test.tsx +36 -0
- package/src/components/ButtonRadiusIcon/index.tsx +24 -0
- package/src/components/ButtonRadiusIcon/stories.tsx +47 -0
- package/src/components/ButtonRadiusIcon/styles.ts +139 -0
- package/src/components/ButtonRound/index.tsx +27 -0
- package/src/components/ButtonRound/stories.tsx +50 -0
- package/src/components/ButtonRound/styles.ts +136 -0
- package/src/components/IconWrapper/index.tsx +45 -0
- package/src/components/Modal/index.tsx +32 -0
- package/src/components/Modal/stories.tsx +53 -0
- package/src/components/Modal/styles.ts +51 -0
- package/src/components/Paragraph/index.tsx +44 -0
- package/src/components/Paragraph/stories.tsx +107 -0
- package/src/components/Tabs/index.tsx +26 -0
- package/src/components/Tabs/stories.tsx +74 -0
- package/src/components/Tabs/styles.ts +23 -0
- package/src/components/Themes/index.ts +99 -0
- package/src/components/Title/index.tsx +35 -0
- package/src/components/Title/stories.tsx +70 -0
- package/src/components/Types/index.ts +45 -0
- package/src/components/index.ts +1 -0
- package/src/index.css +13 -0
- package/src/index.tsx +19 -0
- package/src/logo.svg +1 -0
- package/src/prettier.config.js +11 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/reportWebVitals.ts +16 -0
- package/src/setupTests.ts +5 -0
- package/src/src/globalStyles.ts +11 -0
- package/src/stories/Button.stories.ts +52 -0
- package/src/stories/Button.tsx +42 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.ts +33 -0
- package/src/stories/Header.tsx +56 -0
- package/src/stories/Page.stories.ts +32 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +69 -0
- package/src/utils/constanst.ts +2 -0
- package/tsconfig.json +38 -0
- package/webpack.config.js +12 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
import { theme } from '../Themes'
|
|
3
|
+
import { ButtonTypes } from '../Types'
|
|
4
|
+
|
|
5
|
+
const { colors } = theme
|
|
6
|
+
const buttonRadiusWrapperIconStyles = (color: string) => css`
|
|
7
|
+
.buttonRadiusWrapperIcon {
|
|
8
|
+
margin-top: 4px;
|
|
9
|
+
svg {
|
|
10
|
+
fill: ${color};
|
|
11
|
+
path {
|
|
12
|
+
fill: ${color};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
const colorScheme = {
|
|
18
|
+
primary: css`
|
|
19
|
+
background: ${colors.cyan50};
|
|
20
|
+
&:hover {
|
|
21
|
+
background-color: ${colors.cyan40};
|
|
22
|
+
}
|
|
23
|
+
&:active {
|
|
24
|
+
background-color: ${colors.cyan50};
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
secondary: css`
|
|
28
|
+
background: ${colors.cyan30};
|
|
29
|
+
&:hover {
|
|
30
|
+
background-color: ${colors.cyan40};
|
|
31
|
+
}
|
|
32
|
+
&:active {
|
|
33
|
+
background-color: ${colors.cyan30};
|
|
34
|
+
}
|
|
35
|
+
`,
|
|
36
|
+
danger: css`
|
|
37
|
+
background: ${colors.red40};
|
|
38
|
+
&:hover {
|
|
39
|
+
background-color: ${colors.red30};
|
|
40
|
+
}
|
|
41
|
+
&:active {
|
|
42
|
+
background-color: ${colors.red40};
|
|
43
|
+
}
|
|
44
|
+
`,
|
|
45
|
+
warning: css`
|
|
46
|
+
background: ${colors.honey10};
|
|
47
|
+
color: ${colors.honey30};
|
|
48
|
+
&:hover {
|
|
49
|
+
background-color: ${colors.honey20};
|
|
50
|
+
}
|
|
51
|
+
&:active {
|
|
52
|
+
background-color: ${colors.honey10};
|
|
53
|
+
}
|
|
54
|
+
${buttonRadiusWrapperIconStyles(colors.honey30)};
|
|
55
|
+
`,
|
|
56
|
+
success: css`
|
|
57
|
+
background: ${colors.mint40};
|
|
58
|
+
&:hover {
|
|
59
|
+
background-color: ${colors.mint30};
|
|
60
|
+
}
|
|
61
|
+
&:active {
|
|
62
|
+
background-color: ${colors.mint40};
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
gray: css`
|
|
66
|
+
background: ${colors.shade10};
|
|
67
|
+
color: ${colors.shade40};
|
|
68
|
+
&:hover {
|
|
69
|
+
background-color: ${colors.shade20};
|
|
70
|
+
}
|
|
71
|
+
&:active {
|
|
72
|
+
background-color: ${colors.shade10};
|
|
73
|
+
}
|
|
74
|
+
${buttonRadiusWrapperIconStyles(colors.shade40)};
|
|
75
|
+
`,
|
|
76
|
+
yellow: css`
|
|
77
|
+
background: ${colors.yellow10};
|
|
78
|
+
color: ${colors.yellow30};
|
|
79
|
+
&:hover {
|
|
80
|
+
background-color: ${colors.yellow20};
|
|
81
|
+
}
|
|
82
|
+
&:active {
|
|
83
|
+
background-color: ${colors.yellow10};
|
|
84
|
+
}
|
|
85
|
+
${buttonRadiusWrapperIconStyles(colors.yellow30)};
|
|
86
|
+
`,
|
|
87
|
+
} as const
|
|
88
|
+
|
|
89
|
+
const colorSchemeOutilne = {
|
|
90
|
+
primary: css`
|
|
91
|
+
color: ${colors.cyan50};
|
|
92
|
+
border: 2px solid ${colors.cyan50};
|
|
93
|
+
&:hover {
|
|
94
|
+
background-color: ${colors.cyan10};
|
|
95
|
+
}
|
|
96
|
+
&:active {
|
|
97
|
+
background-color: ${colors.cyan10};
|
|
98
|
+
}
|
|
99
|
+
${buttonRadiusWrapperIconStyles(colors.cyan50)};
|
|
100
|
+
`,
|
|
101
|
+
secondary: css`
|
|
102
|
+
color: ${colors.cyan40};
|
|
103
|
+
border: 2px solid ${colors.cyan40};
|
|
104
|
+
&:hover {
|
|
105
|
+
background-color: ${colors.cyan10};
|
|
106
|
+
}
|
|
107
|
+
&:active {
|
|
108
|
+
background-color: ${colors.cyan10};
|
|
109
|
+
}
|
|
110
|
+
${buttonRadiusWrapperIconStyles(colors.cyan40)};
|
|
111
|
+
`,
|
|
112
|
+
danger: css`
|
|
113
|
+
color: ${colors.red40};
|
|
114
|
+
border: 2px solid ${colors.red40};
|
|
115
|
+
&:hover {
|
|
116
|
+
background-color: ${colors.red10};
|
|
117
|
+
}
|
|
118
|
+
&:active {
|
|
119
|
+
background-color: ${colors.red10};
|
|
120
|
+
}
|
|
121
|
+
${buttonRadiusWrapperIconStyles(colors.red40)};
|
|
122
|
+
`,
|
|
123
|
+
warning: css`
|
|
124
|
+
color: ${colors.honey40};
|
|
125
|
+
border: 2px solid ${colors.honey40};
|
|
126
|
+
&:hover {
|
|
127
|
+
background-color: ${colors.honey10};
|
|
128
|
+
}
|
|
129
|
+
&:active {
|
|
130
|
+
background-color: ${colors.honey10};
|
|
131
|
+
}
|
|
132
|
+
${buttonRadiusWrapperIconStyles(colors.honey40)};
|
|
133
|
+
`,
|
|
134
|
+
success: css`
|
|
135
|
+
color: ${colors.mint40};
|
|
136
|
+
border: 2px solid ${colors.mint40};
|
|
137
|
+
&:hover {
|
|
138
|
+
background-color: ${colors.mint10};
|
|
139
|
+
}
|
|
140
|
+
&:active {
|
|
141
|
+
background-color: ${colors.mint10};
|
|
142
|
+
}
|
|
143
|
+
${buttonRadiusWrapperIconStyles(colors.mint40)};
|
|
144
|
+
`,
|
|
145
|
+
gray: css`
|
|
146
|
+
color: ${colors.shade40};
|
|
147
|
+
border: 2px solid ${colors.shade40};
|
|
148
|
+
&:hover {
|
|
149
|
+
background-color: ${colors.shade20};
|
|
150
|
+
}
|
|
151
|
+
&:active {
|
|
152
|
+
background-color: ${colors.shade10};
|
|
153
|
+
}
|
|
154
|
+
${buttonRadiusWrapperIconStyles(colors.shade40)};
|
|
155
|
+
`,
|
|
156
|
+
yellow: css`
|
|
157
|
+
color: ${colors.yellow30};
|
|
158
|
+
border: 2px solid ${colors.yellow30};
|
|
159
|
+
&:hover {
|
|
160
|
+
background-color: ${colors.yellow10};
|
|
161
|
+
}
|
|
162
|
+
&:active {
|
|
163
|
+
background-color: ${colors.yellow10};
|
|
164
|
+
}
|
|
165
|
+
${buttonRadiusWrapperIconStyles(colors.yellow30)};
|
|
166
|
+
`,
|
|
167
|
+
} as const
|
|
168
|
+
|
|
169
|
+
export const ButtonStyled = styled.button<ButtonTypes>`
|
|
170
|
+
display: inline-flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
box-sizing: border-box;
|
|
174
|
+
height: 48px;
|
|
175
|
+
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
176
|
+
padding: 12px 24px;
|
|
177
|
+
font-size: 16px;
|
|
178
|
+
font-weight: 600;
|
|
179
|
+
line-height: 140%;
|
|
180
|
+
border: none;
|
|
181
|
+
border-radius: ${({ radius }) => (radius ? '24px' : '5px')};
|
|
182
|
+
font-family: 'Nunito Sans', sans-serif;
|
|
183
|
+
transition:
|
|
184
|
+
background-color 0.3s,
|
|
185
|
+
opacity 0.3s;
|
|
186
|
+
color: white;
|
|
187
|
+
gap: 12px;
|
|
188
|
+
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
189
|
+
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
|
|
190
|
+
${({ variant = 'primary', outline }) => (!outline ? colorScheme[variant] : colorSchemeOutilne[variant])};
|
|
191
|
+
background: ${({ outline }) => outline && 'white'};
|
|
192
|
+
border-radius: ${({ halfLeft, halfRight, radius }) =>
|
|
193
|
+
!halfLeft && !halfRight ? (radius ? '24px' : '5px') : halfLeft ? '24px 0 0 24px' : '0 24px 24px 0'};
|
|
194
|
+
|
|
195
|
+
.buttonRadiusWrapperIcon {
|
|
196
|
+
margin-top: 4px;
|
|
197
|
+
}
|
|
198
|
+
`
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import Button from "./index";
|
|
5
|
+
|
|
6
|
+
describe('Button Component', () => {
|
|
7
|
+
test('renders button with primary variant', () => {
|
|
8
|
+
render(<Button variant="primary">Primary Button</Button>);
|
|
9
|
+
const button = screen.getByText('Primary Button');
|
|
10
|
+
expect(button).toBeInTheDocument();
|
|
11
|
+
expect(button).toHaveStyle(`background-color: #1A3D7F`);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('renders button with secondary variant', () => {
|
|
15
|
+
render(<Button variant="secondary">Secondary Button</Button>);
|
|
16
|
+
const button = screen.getByText('Secondary Button');
|
|
17
|
+
expect(button).toBeInTheDocument();
|
|
18
|
+
expect(button).toHaveStyle(`background-color: #217EFD`);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('button responds to click event', () => {
|
|
22
|
+
const handleClick = jest.fn();
|
|
23
|
+
render(<Button variant="primary" onClick={handleClick}>Clickable Button</Button>);
|
|
24
|
+
const button = screen.getByText('Clickable Button');
|
|
25
|
+
fireEvent.click(button);
|
|
26
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('button is disabled when the disabled prop is true', () => {
|
|
30
|
+
render(<Button variant="primary" disabled>Disabled Button</Button>);
|
|
31
|
+
const button = screen.getByText('Disabled Button');
|
|
32
|
+
expect(button).toBeInTheDocument();
|
|
33
|
+
expect(button).toHaveStyle(`opacity: 0.5`);
|
|
34
|
+
expect(button).toHaveStyle(`cursor: not-allowed`);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import IconWrapper from '../IconWrapper'
|
|
3
|
+
import { ButtonStyled } from './styles'
|
|
4
|
+
import { ButtonRadiusIconTypes } from '../Types'
|
|
5
|
+
|
|
6
|
+
const ButtonRadiusIcon: React.FC<ButtonRadiusIconTypes> = ({
|
|
7
|
+
variant = 'primary',
|
|
8
|
+
children,
|
|
9
|
+
disabled = false,
|
|
10
|
+
icon,
|
|
11
|
+
subTitle,
|
|
12
|
+
...props
|
|
13
|
+
}) => (
|
|
14
|
+
<ButtonStyled variant={variant} disabled={disabled} subTitle={subTitle} {...props}>
|
|
15
|
+
<span className={'buttonRadiusIconContainer'}>
|
|
16
|
+
{children} {subTitle && <p className={'buttonRadiusIconTitle'}>{subTitle}</p>}
|
|
17
|
+
</span>
|
|
18
|
+
<span className={'buttonRadiusIconWrapperIcon'}>
|
|
19
|
+
<IconWrapper src={icon || ''} color={'white'} className={'buttonRadiusWrapperIcon'} />
|
|
20
|
+
</span>
|
|
21
|
+
</ButtonStyled>
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
export default ButtonRadiusIcon
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import exampleIcon from '../../assets/icon/image.svg'
|
|
3
|
+
import ButtonRadiusIcon from './index'
|
|
4
|
+
import { VARIANTS_TYPES } from '../../utils/constanst' // Update this path to your actual icon
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof ButtonRadiusIcon> = {
|
|
7
|
+
title: 'Components/ButtonRadiusIcon',
|
|
8
|
+
component: ButtonRadiusIcon,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: {
|
|
13
|
+
type: 'select',
|
|
14
|
+
options: VARIANTS_TYPES,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
},
|
|
20
|
+
icon: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
},
|
|
23
|
+
onClick: { action: 'clicked' },
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof ButtonRadiusIcon>
|
|
29
|
+
|
|
30
|
+
export const Playground: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
variant: 'primary',
|
|
33
|
+
children: 'Primary Button',
|
|
34
|
+
disabled: false,
|
|
35
|
+
icon: exampleIcon,
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const PlaygroundTitlePrimary: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
variant: 'secondary',
|
|
42
|
+
children: 'Button:',
|
|
43
|
+
disabled: false,
|
|
44
|
+
icon: exampleIcon,
|
|
45
|
+
subTitle: 'subTitle',
|
|
46
|
+
},
|
|
47
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
import { theme } from '../Themes'
|
|
3
|
+
import { ButtonRadiusIconTypes } from '../Types'
|
|
4
|
+
|
|
5
|
+
const { colors } = theme
|
|
6
|
+
const buttonRadiusWrapperIconStyles = (color: string) => css`
|
|
7
|
+
.buttonRadiusIconWrapperIcon {
|
|
8
|
+
background: ${color};
|
|
9
|
+
width: 56px;
|
|
10
|
+
height: 100%;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
`
|
|
14
|
+
const colorScheme = {
|
|
15
|
+
primary: css`
|
|
16
|
+
background: ${colors.cyan10};
|
|
17
|
+
color: ${colors.cyan50};
|
|
18
|
+
&:hover {
|
|
19
|
+
background-color: ${colors.cyan10};
|
|
20
|
+
}
|
|
21
|
+
&:active {
|
|
22
|
+
background-color: ${colors.cyan10};
|
|
23
|
+
}
|
|
24
|
+
${buttonRadiusWrapperIconStyles(colors.cyan50)};
|
|
25
|
+
`,
|
|
26
|
+
secondary: css`
|
|
27
|
+
background: ${colors.cyan10};
|
|
28
|
+
color: ${colors.cyan30};
|
|
29
|
+
&:hover {
|
|
30
|
+
background-color: ${colors.cyan10};
|
|
31
|
+
opacity: 0.9;
|
|
32
|
+
}
|
|
33
|
+
&:active {
|
|
34
|
+
background-color: ${colors.cyan10};
|
|
35
|
+
opacity: 1;
|
|
36
|
+
}
|
|
37
|
+
${buttonRadiusWrapperIconStyles(colors.cyan30)};
|
|
38
|
+
`,
|
|
39
|
+
danger: css`
|
|
40
|
+
background: ${colors.red10};
|
|
41
|
+
color: ${colors.red40};
|
|
42
|
+
&:hover {
|
|
43
|
+
background-color: ${colors.red20};
|
|
44
|
+
}
|
|
45
|
+
&:active {
|
|
46
|
+
background-color: ${colors.red10};
|
|
47
|
+
}
|
|
48
|
+
${buttonRadiusWrapperIconStyles(colors.red40)};
|
|
49
|
+
`,
|
|
50
|
+
warning: css`
|
|
51
|
+
background: ${colors.honey10};
|
|
52
|
+
color: ${colors.honey30};
|
|
53
|
+
&:hover {
|
|
54
|
+
background-color: ${colors.honey20};
|
|
55
|
+
}
|
|
56
|
+
&:active {
|
|
57
|
+
background-color: ${colors.honey10};
|
|
58
|
+
}
|
|
59
|
+
${buttonRadiusWrapperIconStyles(colors.honey30)};
|
|
60
|
+
`,
|
|
61
|
+
success: css`
|
|
62
|
+
background: ${colors.mint10};
|
|
63
|
+
color: ${colors.mint40};
|
|
64
|
+
&:hover {
|
|
65
|
+
background-color: ${colors.mint20};
|
|
66
|
+
}
|
|
67
|
+
&:active {
|
|
68
|
+
background-color: ${colors.mint10};
|
|
69
|
+
}
|
|
70
|
+
${buttonRadiusWrapperIconStyles(colors.mint40)};
|
|
71
|
+
`,
|
|
72
|
+
gray: css`
|
|
73
|
+
background: ${colors.shade10};
|
|
74
|
+
color: ${colors.shade40};
|
|
75
|
+
&:hover {
|
|
76
|
+
background-color: ${colors.shade20};
|
|
77
|
+
}
|
|
78
|
+
&:active {
|
|
79
|
+
background-color: ${colors.shade10};
|
|
80
|
+
}
|
|
81
|
+
${buttonRadiusWrapperIconStyles(colors.shade40)};
|
|
82
|
+
`,
|
|
83
|
+
yellow: css`
|
|
84
|
+
background: ${colors.yellow10};
|
|
85
|
+
color: ${colors.yellow30};
|
|
86
|
+
&:hover {
|
|
87
|
+
background-color: ${colors.yellow20};
|
|
88
|
+
opacity: 0.9;
|
|
89
|
+
}
|
|
90
|
+
&:active {
|
|
91
|
+
background-color: ${colors.yellow10};
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
${buttonRadiusWrapperIconStyles(colors.yellow30)};
|
|
95
|
+
`,
|
|
96
|
+
} as const
|
|
97
|
+
|
|
98
|
+
export const ButtonStyled = styled.button<ButtonRadiusIconTypes>`
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
height: 48px;
|
|
102
|
+
padding: 0;
|
|
103
|
+
margin: 0;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
min-width: 190px;
|
|
106
|
+
font-style: normal;
|
|
107
|
+
font-size: 16px;
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
line-height: 140%;
|
|
110
|
+
border: none;
|
|
111
|
+
border-radius: 24px;
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
font-family: 'Nunito Sans', sans-serif;
|
|
114
|
+
transition:
|
|
115
|
+
background-color 0.3s,
|
|
116
|
+
opacity 0.3s;
|
|
117
|
+
color: white;
|
|
118
|
+
|
|
119
|
+
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
120
|
+
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
|
|
121
|
+
${({ variant = 'primary' }) => colorScheme[variant]};
|
|
122
|
+
|
|
123
|
+
.buttonRadiusIconContainer {
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
align-items: center;
|
|
127
|
+
padding: 0 24px;
|
|
128
|
+
gap: 6px;
|
|
129
|
+
height: 48px;
|
|
130
|
+
}
|
|
131
|
+
.buttonRadiusIconTitle {
|
|
132
|
+
color: ${colors.shade40};
|
|
133
|
+
font-weight: 400;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.buttonRadiusWrapperIcon {
|
|
137
|
+
margin-top: 2px;
|
|
138
|
+
}
|
|
139
|
+
`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import IconWrapper from '../IconWrapper'
|
|
3
|
+
import { ButtonStyled } from './styles'
|
|
4
|
+
import { ButtonRoundTypes } from '../Types'
|
|
5
|
+
|
|
6
|
+
const ButtonRound: React.FC<ButtonRoundTypes> = ({
|
|
7
|
+
variant = 'primary',
|
|
8
|
+
children,
|
|
9
|
+
disabled = false,
|
|
10
|
+
icon,
|
|
11
|
+
outline,
|
|
12
|
+
badge,
|
|
13
|
+
...props
|
|
14
|
+
}) => (
|
|
15
|
+
<ButtonStyled variant={variant} disabled={disabled} outline={outline} badge={badge} {...props}>
|
|
16
|
+
{badge && <span className={'buttonRoundBadge'}>{badge}</span>}
|
|
17
|
+
<IconWrapper
|
|
18
|
+
src={icon || ''}
|
|
19
|
+
color={'white'}
|
|
20
|
+
width={'20px'}
|
|
21
|
+
height={'20px'}
|
|
22
|
+
className={'buttonRadiusWrapperIcon'}
|
|
23
|
+
/>
|
|
24
|
+
</ButtonStyled>
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
export default ButtonRound
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import exampleIcon from '../../assets/icon/image.svg'
|
|
3
|
+
|
|
4
|
+
import { VARIANTS_TYPES } from '../../utils/constanst'
|
|
5
|
+
import ButtonRound from './index'
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof ButtonRound> = {
|
|
8
|
+
title: 'Components/ButtonRound',
|
|
9
|
+
component: ButtonRound,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
variant: {
|
|
13
|
+
control: {
|
|
14
|
+
type: 'select',
|
|
15
|
+
options: VARIANTS_TYPES,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
control: 'boolean',
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
control: 'object',
|
|
23
|
+
options: [exampleIcon],
|
|
24
|
+
description: exampleIcon,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
onClick: { action: 'clicked' },
|
|
28
|
+
},
|
|
29
|
+
} satisfies Meta<typeof ButtonRound>
|
|
30
|
+
|
|
31
|
+
export default meta
|
|
32
|
+
type Story = StoryObj<typeof ButtonRound>
|
|
33
|
+
|
|
34
|
+
export const Playground: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
variant: 'primary',
|
|
37
|
+
children: 'ButtonPlayground',
|
|
38
|
+
disabled: false,
|
|
39
|
+
icon: exampleIcon,
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
export const ButtonBadge: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
variant: 'success',
|
|
45
|
+
children: 'ButtonPlayground',
|
|
46
|
+
disabled: false,
|
|
47
|
+
icon: exampleIcon,
|
|
48
|
+
badge: 10,
|
|
49
|
+
},
|
|
50
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
import { theme } from '../Themes'
|
|
3
|
+
import { ButtonRoundTypes } from '../Types'
|
|
4
|
+
|
|
5
|
+
const { colors } = theme
|
|
6
|
+
const buttonRadiusWrapperIconStyles = (color: string) => css`
|
|
7
|
+
.buttonRadiusWrapperIcon {
|
|
8
|
+
svg {
|
|
9
|
+
fill: ${color};
|
|
10
|
+
path {
|
|
11
|
+
fill: ${color};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.buttonRoundBadge {
|
|
16
|
+
background: ${color};
|
|
17
|
+
}
|
|
18
|
+
`
|
|
19
|
+
const colorScheme = {
|
|
20
|
+
primary: css`
|
|
21
|
+
background: ${colors.shade10};
|
|
22
|
+
${buttonRadiusWrapperIconStyles(colors.shade30)}
|
|
23
|
+
&:hover {
|
|
24
|
+
background-color: ${colors.shade20};
|
|
25
|
+
${buttonRadiusWrapperIconStyles(colors.cyan40)};
|
|
26
|
+
}
|
|
27
|
+
&:active {
|
|
28
|
+
background-color: ${colors.shade10};
|
|
29
|
+
${buttonRadiusWrapperIconStyles(colors.shade30)};
|
|
30
|
+
}
|
|
31
|
+
`,
|
|
32
|
+
secondary: css`
|
|
33
|
+
background: ${colors.cyan10};
|
|
34
|
+
&:hover {
|
|
35
|
+
background-color: ${colors.cyan10};
|
|
36
|
+
${buttonRadiusWrapperIconStyles(colors.cyan30)}
|
|
37
|
+
}
|
|
38
|
+
&:active {
|
|
39
|
+
background-color: ${colors.cyan10};
|
|
40
|
+
}
|
|
41
|
+
${buttonRadiusWrapperIconStyles(colors.cyan40)};
|
|
42
|
+
`,
|
|
43
|
+
danger: css`
|
|
44
|
+
background: ${colors.red10};
|
|
45
|
+
&:hover {
|
|
46
|
+
background-color: ${colors.red20};
|
|
47
|
+
}
|
|
48
|
+
&:active {
|
|
49
|
+
background-color: ${colors.red10};
|
|
50
|
+
}
|
|
51
|
+
${buttonRadiusWrapperIconStyles(colors.red40)};
|
|
52
|
+
`,
|
|
53
|
+
warning: css`
|
|
54
|
+
background: ${colors.honey10};
|
|
55
|
+
color: ${colors.honey30};
|
|
56
|
+
&:hover {
|
|
57
|
+
background-color: ${colors.honey20};
|
|
58
|
+
}
|
|
59
|
+
&:active {
|
|
60
|
+
background-color: ${colors.honey10};
|
|
61
|
+
}
|
|
62
|
+
${buttonRadiusWrapperIconStyles(colors.honey30)};
|
|
63
|
+
`,
|
|
64
|
+
success: css`
|
|
65
|
+
background: ${colors.mint10};
|
|
66
|
+
&:hover {
|
|
67
|
+
background-color: ${colors.mint20};
|
|
68
|
+
}
|
|
69
|
+
&:active {
|
|
70
|
+
background-color: ${colors.mint10};
|
|
71
|
+
}
|
|
72
|
+
${buttonRadiusWrapperIconStyles(colors.mint40)};
|
|
73
|
+
`,
|
|
74
|
+
gray: css`
|
|
75
|
+
background: ${colors.shade10};
|
|
76
|
+
&:hover {
|
|
77
|
+
background-color: ${colors.shade20};
|
|
78
|
+
}
|
|
79
|
+
&:active {
|
|
80
|
+
background-color: ${colors.shade10};
|
|
81
|
+
}
|
|
82
|
+
${buttonRadiusWrapperIconStyles(colors.shade40)};
|
|
83
|
+
`,
|
|
84
|
+
yellow: css`
|
|
85
|
+
background: ${colors.yellow10};
|
|
86
|
+
&:hover {
|
|
87
|
+
background-color: ${colors.yellow20};
|
|
88
|
+
}
|
|
89
|
+
&:active {
|
|
90
|
+
background-color: ${colors.yellow10};
|
|
91
|
+
}
|
|
92
|
+
${buttonRadiusWrapperIconStyles(colors.yellow30)};
|
|
93
|
+
`,
|
|
94
|
+
} as const
|
|
95
|
+
|
|
96
|
+
export const ButtonStyled = styled.button<ButtonRoundTypes>`
|
|
97
|
+
display: inline-flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
height: 48px;
|
|
102
|
+
width: 48px;
|
|
103
|
+
font-size: 16px;
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
line-height: 140%;
|
|
106
|
+
border: none;
|
|
107
|
+
border-radius: 100%;
|
|
108
|
+
font-family: 'Nunito Sans', sans-serif;
|
|
109
|
+
transition:
|
|
110
|
+
color 0.3s,
|
|
111
|
+
background-color 0.3s,
|
|
112
|
+
opacity 0.3s;
|
|
113
|
+
color: white;
|
|
114
|
+
gap: 12px;
|
|
115
|
+
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
116
|
+
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
|
|
117
|
+
${({ variant = 'primary', outline }) => colorScheme[variant]};
|
|
118
|
+
|
|
119
|
+
.buttonRadiusWrapperIcon {
|
|
120
|
+
margin-top: 4px;
|
|
121
|
+
}
|
|
122
|
+
.buttonRoundBadge {
|
|
123
|
+
box-sizing: border-box;
|
|
124
|
+
margin-bottom: 24px;
|
|
125
|
+
margin-left: 54px;
|
|
126
|
+
position: absolute;
|
|
127
|
+
width: 26px;
|
|
128
|
+
height: 26px;
|
|
129
|
+
border-radius: 100%;
|
|
130
|
+
font-size: 12px;
|
|
131
|
+
display: flex;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
align-items: center;
|
|
134
|
+
border: 2px solid;
|
|
135
|
+
}
|
|
136
|
+
`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import styled from 'styled-components'
|
|
3
|
+
import { ReactSVG } from 'react-svg'
|
|
4
|
+
|
|
5
|
+
interface IconWrapperProps {
|
|
6
|
+
src: string
|
|
7
|
+
color?: string
|
|
8
|
+
width?: string
|
|
9
|
+
height?: string
|
|
10
|
+
className?: string
|
|
11
|
+
onClick?: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface IconWrappeProps {
|
|
15
|
+
color?: string
|
|
16
|
+
width?: string
|
|
17
|
+
height?: string
|
|
18
|
+
onClick?: () => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const StyledIconWrapper = styled.div<IconWrappeProps>`
|
|
22
|
+
height: 100%;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
cursor: ${props => (props.onClick ? 'pointer' : 'default')};
|
|
28
|
+
svg {
|
|
29
|
+
width: ${props => props.width || '24px'};
|
|
30
|
+
height: ${props => props.height || '24px'};
|
|
31
|
+
fill: ${props => props.color || 'black'};
|
|
32
|
+
|
|
33
|
+
path {
|
|
34
|
+
fill: ${props => props.color || 'black'};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
const IconWrapper: React.FC<IconWrapperProps> = ({ src, color, width, height, className, onClick }) => (
|
|
40
|
+
<StyledIconWrapper color={color} width={width} height={height} className={className} onClick={onClick}>
|
|
41
|
+
<ReactSVG src={src} />
|
|
42
|
+
</StyledIconWrapper>
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
export default IconWrapper
|