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.
Files changed (294) hide show
  1. package/.storybook/main.ts +19 -0
  2. package/.storybook/preview.ts +14 -0
  3. package/README.md +46 -0
  4. package/README.old.md +1 -0
  5. package/dist/App.d.ts +5 -0
  6. package/dist/App.d.ts.map +1 -0
  7. package/dist/App.js +9 -0
  8. package/dist/App.js.map +1 -0
  9. package/dist/App.test.d.ts +2 -0
  10. package/dist/App.test.d.ts.map +1 -0
  11. package/dist/App.test.js +9 -0
  12. package/dist/App.test.js.map +1 -0
  13. package/dist/assets/icon/index.d.ts +7 -0
  14. package/dist/assets/icon/index.d.ts.map +1 -0
  15. package/dist/assets/icon/index.js +7 -0
  16. package/dist/assets/icon/index.js.map +1 -0
  17. package/dist/components/Banner/index.d.ts +5 -0
  18. package/dist/components/Banner/index.d.ts.map +1 -0
  19. package/dist/components/Banner/index.js +33 -0
  20. package/dist/components/Banner/index.js.map +1 -0
  21. package/dist/components/Banner/stories.d.ts +7 -0
  22. package/dist/components/Banner/stories.d.ts.map +1 -0
  23. package/dist/components/Banner/stories.js +25 -0
  24. package/dist/components/Banner/stories.js.map +1 -0
  25. package/dist/components/Banner/styles.d.ts +4 -0
  26. package/dist/components/Banner/styles.d.ts.map +1 -0
  27. package/dist/components/Banner/styles.js +55 -0
  28. package/dist/components/Banner/styles.js.map +1 -0
  29. package/dist/components/Button /index.d.ts +5 -0
  30. package/dist/components/Button /index.d.ts.map +1 -0
  31. package/dist/components/Button /index.js +22 -0
  32. package/dist/components/Button /index.js.map +1 -0
  33. package/dist/components/Button /stories.d.ts +14 -0
  34. package/dist/components/Button /stories.d.ts.map +1 -0
  35. package/dist/components/Button /stories.js +88 -0
  36. package/dist/components/Button /stories.js.map +1 -0
  37. package/dist/components/Button /styles.d.ts +4 -0
  38. package/dist/components/Button /styles.d.ts.map +1 -0
  39. package/dist/components/Button /styles.js +194 -0
  40. package/dist/components/Button /styles.js.map +1 -0
  41. package/dist/components/Button /test.d.ts +2 -0
  42. package/dist/components/Button /test.d.ts.map +1 -0
  43. package/dist/components/Button /test.js +33 -0
  44. package/dist/components/Button /test.js.map +1 -0
  45. package/dist/components/ButtonRadiusIcon/index.d.ts +5 -0
  46. package/dist/components/ButtonRadiusIcon/index.d.ts.map +1 -0
  47. package/dist/components/ButtonRadiusIcon/index.js +26 -0
  48. package/dist/components/ButtonRadiusIcon/index.js.map +1 -0
  49. package/dist/components/ButtonRadiusIcon/stories.d.ts +8 -0
  50. package/dist/components/ButtonRadiusIcon/stories.d.ts.map +1 -0
  51. package/dist/components/ButtonRadiusIcon/stories.js +42 -0
  52. package/dist/components/ButtonRadiusIcon/stories.js.map +1 -0
  53. package/dist/components/ButtonRadiusIcon/styles.d.ts +4 -0
  54. package/dist/components/ButtonRadiusIcon/styles.d.ts.map +1 -0
  55. package/dist/components/ButtonRadiusIcon/styles.js +137 -0
  56. package/dist/components/ButtonRadiusIcon/styles.js.map +1 -0
  57. package/dist/components/ButtonRound/index.d.ts +5 -0
  58. package/dist/components/ButtonRound/index.d.ts.map +1 -0
  59. package/dist/components/ButtonRound/index.js +22 -0
  60. package/dist/components/ButtonRound/index.js.map +1 -0
  61. package/dist/components/ButtonRound/stories.d.ts +8 -0
  62. package/dist/components/ButtonRound/stories.d.ts.map +1 -0
  63. package/dist/components/ButtonRound/stories.js +44 -0
  64. package/dist/components/ButtonRound/stories.js.map +1 -0
  65. package/dist/components/ButtonRound/styles.d.ts +4 -0
  66. package/dist/components/ButtonRound/styles.d.ts.map +1 -0
  67. package/dist/components/ButtonRound/styles.js +134 -0
  68. package/dist/components/ButtonRound/styles.js.map +1 -0
  69. package/dist/components/IconWrapper/index.d.ts +12 -0
  70. package/dist/components/IconWrapper/index.d.ts.map +1 -0
  71. package/dist/components/IconWrapper/index.js +24 -0
  72. package/dist/components/IconWrapper/index.js.map +1 -0
  73. package/dist/components/Modal/index.d.ts +5 -0
  74. package/dist/components/Modal/index.d.ts.map +1 -0
  75. package/dist/components/Modal/index.js +32 -0
  76. package/dist/components/Modal/index.js.map +1 -0
  77. package/dist/components/Modal/stories.d.ts +7 -0
  78. package/dist/components/Modal/stories.d.ts.map +1 -0
  79. package/dist/components/Modal/stories.js +24 -0
  80. package/dist/components/Modal/stories.js.map +1 -0
  81. package/dist/components/Modal/styles.d.ts +4 -0
  82. package/dist/components/Modal/styles.d.ts.map +1 -0
  83. package/dist/components/Modal/styles.js +48 -0
  84. package/dist/components/Modal/styles.js.map +1 -0
  85. package/dist/components/Paragraph/index.d.ts +11 -0
  86. package/dist/components/Paragraph/index.d.ts.map +1 -0
  87. package/dist/components/Paragraph/index.js +28 -0
  88. package/dist/components/Paragraph/index.js.map +1 -0
  89. package/dist/components/Paragraph/stories.d.ts +14 -0
  90. package/dist/components/Paragraph/stories.d.ts.map +1 -0
  91. package/dist/components/Paragraph/stories.js +95 -0
  92. package/dist/components/Paragraph/stories.js.map +1 -0
  93. package/dist/components/Tabs/index.d.ts +5 -0
  94. package/dist/components/Tabs/index.d.ts.map +1 -0
  95. package/dist/components/Tabs/index.js +14 -0
  96. package/dist/components/Tabs/index.js.map +1 -0
  97. package/dist/components/Tabs/stories.d.ts +7 -0
  98. package/dist/components/Tabs/stories.d.ts.map +1 -0
  99. package/dist/components/Tabs/stories.js +31 -0
  100. package/dist/components/Tabs/stories.js.map +1 -0
  101. package/dist/components/Tabs/styles.d.ts +6 -0
  102. package/dist/components/Tabs/styles.d.ts.map +1 -0
  103. package/dist/components/Tabs/styles.js +22 -0
  104. package/dist/components/Tabs/styles.js.map +1 -0
  105. package/dist/components/Themes/index.d.ts +79 -0
  106. package/dist/components/Themes/index.d.ts.map +1 -0
  107. package/dist/components/Themes/index.js +83 -0
  108. package/dist/components/Themes/index.js.map +1 -0
  109. package/dist/components/Title/index.d.ts +11 -0
  110. package/dist/components/Title/index.d.ts.map +1 -0
  111. package/dist/components/Title/index.js +18 -0
  112. package/dist/components/Title/index.js.map +1 -0
  113. package/dist/components/Title/stories.d.ts +9 -0
  114. package/dist/components/Title/stories.d.ts.map +1 -0
  115. package/dist/components/Title/stories.js +61 -0
  116. package/dist/components/Title/stories.js.map +1 -0
  117. package/dist/components/Types/index.d.ts +41 -0
  118. package/dist/components/Types/index.d.ts.map +1 -0
  119. package/dist/components/Types/index.js +2 -0
  120. package/dist/components/Types/index.js.map +1 -0
  121. package/dist/components/index.d.ts +2 -0
  122. package/dist/components/index.d.ts.map +1 -0
  123. package/dist/components/index.js +2 -0
  124. package/dist/components/index.js.map +1 -0
  125. package/dist/index.d.ts +2 -0
  126. package/dist/index.d.ts.map +1 -0
  127. package/dist/index.js +13 -0
  128. package/dist/index.js.map +1 -0
  129. package/dist/prettier.config.d.ts +10 -0
  130. package/dist/prettier.config.d.ts.map +1 -0
  131. package/dist/prettier.config.js +13 -0
  132. package/dist/prettier.config.js.map +1 -0
  133. package/dist/reportWebVitals.d.ts +4 -0
  134. package/dist/reportWebVitals.d.ts.map +1 -0
  135. package/dist/reportWebVitals.js +14 -0
  136. package/dist/reportWebVitals.js.map +1 -0
  137. package/dist/setupTests.d.ts +2 -0
  138. package/dist/setupTests.d.ts.map +1 -0
  139. package/dist/setupTests.js +6 -0
  140. package/dist/setupTests.js.map +1 -0
  141. package/dist/src/globalStyles.d.ts +4 -0
  142. package/dist/src/globalStyles.d.ts.map +1 -0
  143. package/dist/src/globalStyles.js +10 -0
  144. package/dist/src/globalStyles.js.map +1 -0
  145. package/dist/stories/Button.d.ts +29 -0
  146. package/dist/stories/Button.d.ts.map +1 -0
  147. package/dist/stories/Button.js +22 -0
  148. package/dist/stories/Button.js.map +1 -0
  149. package/dist/stories/Button.stories.d.ts +25 -0
  150. package/dist/stories/Button.stories.d.ts.map +1 -0
  151. package/dist/stories/Button.stories.js +45 -0
  152. package/dist/stories/Button.stories.js.map +1 -0
  153. package/dist/stories/Header.d.ts +14 -0
  154. package/dist/stories/Header.d.ts.map +1 -0
  155. package/dist/stories/Header.js +21 -0
  156. package/dist/stories/Header.js.map +1 -0
  157. package/dist/stories/Header.stories.d.ts +20 -0
  158. package/dist/stories/Header.stories.d.ts.map +1 -0
  159. package/dist/stories/Header.stories.js +27 -0
  160. package/dist/stories/Header.stories.js.map +1 -0
  161. package/dist/stories/Page.d.ts +4 -0
  162. package/dist/stories/Page.d.ts.map +1 -0
  163. package/dist/stories/Page.js +38 -0
  164. package/dist/stories/Page.js.map +1 -0
  165. package/dist/stories/Page.stories.d.ts +14 -0
  166. package/dist/stories/Page.stories.d.ts.map +1 -0
  167. package/dist/stories/Page.stories.js +34 -0
  168. package/dist/stories/Page.stories.js.map +1 -0
  169. package/dist/types/App.d.ts +4 -0
  170. package/dist/types/App.test.d.ts +1 -0
  171. package/dist/types/assets/icon/index.d.ts +6 -0
  172. package/dist/types/components/Banner/index.d.ts +4 -0
  173. package/dist/types/components/Banner/stories.d.ts +6 -0
  174. package/dist/types/components/Banner/styles.d.ts +3 -0
  175. package/dist/types/components/Button /index.d.ts +4 -0
  176. package/dist/types/components/Button /stories.d.ts +13 -0
  177. package/dist/types/components/Button /styles.d.ts +3 -0
  178. package/dist/types/components/Button /test.d.ts +1 -0
  179. package/dist/types/components/ButtonRadiusIcon/index.d.ts +4 -0
  180. package/dist/types/components/ButtonRadiusIcon/stories.d.ts +7 -0
  181. package/dist/types/components/ButtonRadiusIcon/styles.d.ts +3 -0
  182. package/dist/types/components/ButtonRound/index.d.ts +4 -0
  183. package/dist/types/components/ButtonRound/stories.d.ts +7 -0
  184. package/dist/types/components/ButtonRound/styles.d.ts +3 -0
  185. package/dist/types/components/IconWrapper/index.d.ts +11 -0
  186. package/dist/types/components/Modal/index.d.ts +4 -0
  187. package/dist/types/components/Modal/stories.d.ts +6 -0
  188. package/dist/types/components/Modal/styles.d.ts +3 -0
  189. package/dist/types/components/Paragraph/index.d.ts +10 -0
  190. package/dist/types/components/Paragraph/stories.d.ts +13 -0
  191. package/dist/types/components/Tabs/index.d.ts +4 -0
  192. package/dist/types/components/Tabs/stories.d.ts +6 -0
  193. package/dist/types/components/Tabs/styles.d.ts +5 -0
  194. package/dist/types/components/Themes/index.d.ts +78 -0
  195. package/dist/types/components/Title/index.d.ts +10 -0
  196. package/dist/types/components/Title/stories.d.ts +8 -0
  197. package/dist/types/components/Types/index.d.ts +40 -0
  198. package/dist/types/components/index.d.ts +1 -0
  199. package/dist/types/index.d.ts +1 -0
  200. package/dist/types/reportWebVitals.d.ts +3 -0
  201. package/dist/types/setupTests.d.ts +1 -0
  202. package/dist/types/src/globalStyles.d.ts +3 -0
  203. package/dist/types/stories/Button.d.ts +28 -0
  204. package/dist/types/stories/Button.stories.d.ts +24 -0
  205. package/dist/types/stories/Header.d.ts +13 -0
  206. package/dist/types/stories/Header.stories.d.ts +19 -0
  207. package/dist/types/stories/Page.d.ts +3 -0
  208. package/dist/types/stories/Page.stories.d.ts +13 -0
  209. package/dist/types/utils/constanst.d.ts +2 -0
  210. package/dist/utils/constanst.d.ts +3 -0
  211. package/dist/utils/constanst.d.ts.map +1 -0
  212. package/dist/utils/constanst.js +3 -0
  213. package/dist/utils/constanst.js.map +1 -0
  214. package/package.json +69 -0
  215. package/public/favicon.ico +0 -0
  216. package/public/index.html +43 -0
  217. package/public/logo192.png +0 -0
  218. package/public/logo512.png +0 -0
  219. package/public/manifest.json +25 -0
  220. package/public/robots.txt +3 -0
  221. package/src/App.css +39 -0
  222. package/src/App.test.tsx +9 -0
  223. package/src/App.tsx +14 -0
  224. package/src/assets/icon/alert.svg +3 -0
  225. package/src/assets/icon/close.svg +10 -0
  226. package/src/assets/icon/comment.svg +10 -0
  227. package/src/assets/icon/doc-check.svg +10 -0
  228. package/src/assets/icon/image.svg +3 -0
  229. package/src/assets/icon/index.ts +6 -0
  230. package/src/assets/icon/svg.d.ts +4 -0
  231. package/src/components/Banner/index.tsx +49 -0
  232. package/src/components/Banner/stories.tsx +31 -0
  233. package/src/components/Banner/styles.ts +58 -0
  234. package/src/components/Button /index.tsx +33 -0
  235. package/src/components/Button /stories.tsx +98 -0
  236. package/src/components/Button /styles.ts +198 -0
  237. package/src/components/Button /test.tsx +36 -0
  238. package/src/components/ButtonRadiusIcon/index.tsx +24 -0
  239. package/src/components/ButtonRadiusIcon/stories.tsx +47 -0
  240. package/src/components/ButtonRadiusIcon/styles.ts +139 -0
  241. package/src/components/ButtonRound/index.tsx +27 -0
  242. package/src/components/ButtonRound/stories.tsx +50 -0
  243. package/src/components/ButtonRound/styles.ts +136 -0
  244. package/src/components/IconWrapper/index.tsx +45 -0
  245. package/src/components/Modal/index.tsx +32 -0
  246. package/src/components/Modal/stories.tsx +53 -0
  247. package/src/components/Modal/styles.ts +51 -0
  248. package/src/components/Paragraph/index.tsx +44 -0
  249. package/src/components/Paragraph/stories.tsx +107 -0
  250. package/src/components/Tabs/index.tsx +26 -0
  251. package/src/components/Tabs/stories.tsx +74 -0
  252. package/src/components/Tabs/styles.ts +23 -0
  253. package/src/components/Themes/index.ts +99 -0
  254. package/src/components/Title/index.tsx +35 -0
  255. package/src/components/Title/stories.tsx +70 -0
  256. package/src/components/Types/index.ts +45 -0
  257. package/src/components/index.ts +1 -0
  258. package/src/index.css +13 -0
  259. package/src/index.tsx +19 -0
  260. package/src/logo.svg +1 -0
  261. package/src/prettier.config.js +11 -0
  262. package/src/react-app-env.d.ts +1 -0
  263. package/src/reportWebVitals.ts +16 -0
  264. package/src/setupTests.ts +5 -0
  265. package/src/src/globalStyles.ts +11 -0
  266. package/src/stories/Button.stories.ts +52 -0
  267. package/src/stories/Button.tsx +42 -0
  268. package/src/stories/Configure.mdx +364 -0
  269. package/src/stories/Header.stories.ts +33 -0
  270. package/src/stories/Header.tsx +56 -0
  271. package/src/stories/Page.stories.ts +32 -0
  272. package/src/stories/Page.tsx +73 -0
  273. package/src/stories/assets/accessibility.png +0 -0
  274. package/src/stories/assets/accessibility.svg +1 -0
  275. package/src/stories/assets/addon-library.png +0 -0
  276. package/src/stories/assets/assets.png +0 -0
  277. package/src/stories/assets/avif-test-image.avif +0 -0
  278. package/src/stories/assets/context.png +0 -0
  279. package/src/stories/assets/discord.svg +1 -0
  280. package/src/stories/assets/docs.png +0 -0
  281. package/src/stories/assets/figma-plugin.png +0 -0
  282. package/src/stories/assets/github.svg +1 -0
  283. package/src/stories/assets/share.png +0 -0
  284. package/src/stories/assets/styling.png +0 -0
  285. package/src/stories/assets/testing.png +0 -0
  286. package/src/stories/assets/theming.png +0 -0
  287. package/src/stories/assets/tutorials.svg +1 -0
  288. package/src/stories/assets/youtube.svg +1 -0
  289. package/src/stories/button.css +30 -0
  290. package/src/stories/header.css +32 -0
  291. package/src/stories/page.css +69 -0
  292. package/src/utils/constanst.ts +2 -0
  293. package/tsconfig.json +38 -0
  294. 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