@ayseaistudio/ui-components 1.0.0
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/dist/PrimaryButton/PrimaryButton.d.ts +26 -0
- package/dist/PrimaryButton/PrimaryButton.js +54 -0
- package/dist/PrimaryButton/index.d.ts +1 -0
- package/dist/PrimaryButton/index.js +1 -0
- package/dist/PrimaryButton/style.css +367 -0
- package/dist/SecondaryButton/SecondaryButton.d.ts +26 -0
- package/dist/SecondaryButton/SecondaryButton.js +52 -0
- package/dist/SecondaryButton/index.d.ts +1 -0
- package/dist/SecondaryButton/index.js +1 -0
- package/dist/SecondaryButton/style.css +403 -0
- package/dist/SelectionButton/SelectionButton.d.ts +26 -0
- package/dist/SelectionButton/SelectionButton.js +52 -0
- package/dist/SelectionButton/index.d.ts +1 -0
- package/dist/SelectionButton/index.js +1 -0
- package/dist/SelectionButton/style.css +320 -0
- package/dist/TertiaryButton/TertiaryButton.d.ts +26 -0
- package/dist/TertiaryButton/TertiaryButton.js +40 -0
- package/dist/TertiaryButton/index.d.ts +1 -0
- package/dist/TertiaryButton/index.js +1 -0
- package/dist/TertiaryButton/style.css +254 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +27 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import "./style.css";
|
|
3
|
+
interface Props {
|
|
4
|
+
text?: string;
|
|
5
|
+
leftIcon?: React.JSX.Element;
|
|
6
|
+
rightIcon?: React.JSX.Element;
|
|
7
|
+
size?: "large" | "medium" | "small";
|
|
8
|
+
color: "mauve" | "lime" | "olive" | "black" | "zest" | "blue" | "orange" | "galliano" | "green" | "red";
|
|
9
|
+
status?: "pressing" | "disabled" | "hover" | "default";
|
|
10
|
+
className?: any;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const PrimaryButton: {
|
|
14
|
+
({ text, size, color, status, className, leftIcon, rightIcon, onClick, }: Props): React.JSX.Element;
|
|
15
|
+
propTypes: {
|
|
16
|
+
text: PropTypes.Requireable<string>;
|
|
17
|
+
leftIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
18
|
+
rightIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
19
|
+
size: PropTypes.Requireable<string>;
|
|
20
|
+
color: PropTypes.Requireable<string>;
|
|
21
|
+
status: PropTypes.Requireable<string>;
|
|
22
|
+
className: PropTypes.Requireable<any>;
|
|
23
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { useReducer } from "react";
|
|
4
|
+
import "./style.css";
|
|
5
|
+
export const PrimaryButton = ({ text, size, color, status, className, leftIcon, rightIcon, onClick, }) => {
|
|
6
|
+
const [state, dispatch] = useReducer(reducer, {
|
|
7
|
+
size: size || "large",
|
|
8
|
+
color: color || "black",
|
|
9
|
+
status: status || "default",
|
|
10
|
+
});
|
|
11
|
+
return (_jsxs("div", { className: `primary-button ${state.size} ${state.status} ${state.color} ${className}`, "data-primitives-mode": ["black", "blue", "lime", "mauve", "olive"].includes(state.color)
|
|
12
|
+
? "value"
|
|
13
|
+
: undefined, onClick: onClick, onMouseLeave: () => {
|
|
14
|
+
dispatch("mouse_leave");
|
|
15
|
+
}, onMouseEnter: () => {
|
|
16
|
+
dispatch("mouse_enter");
|
|
17
|
+
}, children: [leftIcon && (_jsx("span", { className: `${state.size === "small" ? "class icon" : "class-2 icon"}`, children: leftIcon })), text && _jsx("div", { className: "button", children: text }), rightIcon && (_jsx("span", { className: `${state.size === "small" ? "class icon" : "class-2 icon"}`, children: rightIcon }))] }));
|
|
18
|
+
};
|
|
19
|
+
function reducer(state, action) {
|
|
20
|
+
switch (action) {
|
|
21
|
+
case "mouse_enter":
|
|
22
|
+
return {
|
|
23
|
+
...state,
|
|
24
|
+
status: "hover",
|
|
25
|
+
};
|
|
26
|
+
case "mouse_leave":
|
|
27
|
+
return {
|
|
28
|
+
...state,
|
|
29
|
+
status: "default",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
PrimaryButton.propTypes = {
|
|
35
|
+
text: PropTypes.string,
|
|
36
|
+
leftIcon: PropTypes.node,
|
|
37
|
+
rightIcon: PropTypes.node,
|
|
38
|
+
size: PropTypes.oneOf(["large", "medium", "small"]),
|
|
39
|
+
color: PropTypes.oneOf([
|
|
40
|
+
"mauve",
|
|
41
|
+
"lime",
|
|
42
|
+
"olive",
|
|
43
|
+
"black",
|
|
44
|
+
"zest",
|
|
45
|
+
"blue",
|
|
46
|
+
"orange",
|
|
47
|
+
"galliano",
|
|
48
|
+
"green",
|
|
49
|
+
"red",
|
|
50
|
+
]),
|
|
51
|
+
status: PropTypes.oneOf(["pressing", "disabled", "hover", "default"]),
|
|
52
|
+
className: PropTypes.any,
|
|
53
|
+
onClick: PropTypes.func,
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PrimaryButton } from "./PrimaryButton";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PrimaryButton } from "./PrimaryButton";
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
.primary-button {
|
|
2
|
+
align-items: center;
|
|
3
|
+
box-shadow: inset 0px 0px 10px #ffffff80;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
position: relative;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.primary-button .icon {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
line-height: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.primary-button .class {
|
|
18
|
+
height: 16px !important;
|
|
19
|
+
position: relative !important;
|
|
20
|
+
width: 16px !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.primary-button .class-2 {
|
|
24
|
+
height: 20px !important;
|
|
25
|
+
position: relative !important;
|
|
26
|
+
width: 20px !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.primary-button .button {
|
|
30
|
+
align-items: center;
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
margin-top: -1.00px;
|
|
34
|
+
position: relative;
|
|
35
|
+
text-align: center;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
width: fit-content;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Icons inherit current color to match text */
|
|
41
|
+
.primary-button .icon svg {
|
|
42
|
+
color: currentColor;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.primary-button.large {
|
|
46
|
+
border-radius: 12px;
|
|
47
|
+
gap: 6px;
|
|
48
|
+
padding: 12px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.primary-button.small {
|
|
52
|
+
border-radius: 8px;
|
|
53
|
+
gap: 4px;
|
|
54
|
+
padding: 6px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.primary-button.medium {
|
|
58
|
+
border-radius: 8px;
|
|
59
|
+
gap: 4px;
|
|
60
|
+
padding: 8px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.primary-button.disabled {
|
|
64
|
+
background-color: #b0b0b0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.primary-button.hover.galliano {
|
|
68
|
+
background-color: #d7af1b;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.primary-button.pressing.galliano {
|
|
72
|
+
background-color: #b98915;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.primary-button.hover.black {
|
|
76
|
+
background-color: #3d3d3d;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.primary-button.red.default {
|
|
80
|
+
background-color: #ff3737;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.primary-button.default.mauve {
|
|
84
|
+
background-color: #e0b0ff;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.primary-button.default.olive {
|
|
88
|
+
background-color: #59743c;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.primary-button.default.black {
|
|
92
|
+
background-color: #303030;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.primary-button.lime.hover {
|
|
96
|
+
background-color: #98d317;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.primary-button.lime.pressing {
|
|
100
|
+
background-color: #71a30d;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.primary-button.hover.blue {
|
|
104
|
+
background-color: var(--colorsportage-500);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.primary-button.pressing.blue {
|
|
108
|
+
background-color: var(--colorsportage-700);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.primary-button.pressing.black {
|
|
112
|
+
background-color: #454545;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.primary-button.lime.default {
|
|
116
|
+
background-color: #b1e635;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.primary-button.default.blue {
|
|
120
|
+
background-color: var(--colorsportage-400);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.primary-button.galliano.default {
|
|
124
|
+
background-color: #e6c629;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.primary-button.hover.orange {
|
|
128
|
+
background-color: #bd2d11;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.primary-button.pressing.orange {
|
|
132
|
+
background-color: #792115;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.primary-button.zest.pressing {
|
|
136
|
+
background-color: #cd6512;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.primary-button.zest.hover {
|
|
140
|
+
background-color: #e78719;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.primary-button.pressing.olive {
|
|
144
|
+
background-color: #3a492b;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.primary-button.hover.olive {
|
|
148
|
+
background-color: #455a31;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.primary-button.default.green {
|
|
152
|
+
background-color: #36b151;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.primary-button.hover.green {
|
|
156
|
+
background-color: #289140;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.primary-button.pressing.green {
|
|
160
|
+
background-color: #227334;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.primary-button.red.pressing {
|
|
164
|
+
background-color: #a50f0f;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.primary-button.hover.mauve {
|
|
168
|
+
background-color: #cf82fe;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.primary-button.red.hover {
|
|
172
|
+
background-color: #c80d0d;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.primary-button.default.orange {
|
|
176
|
+
background-color: #f4672f;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.primary-button.zest.default {
|
|
180
|
+
background-color: #eea62b;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.primary-button.pressing.mauve {
|
|
184
|
+
background-color: #bc53f9;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.primary-button.large .button {
|
|
188
|
+
font-family: var(--h6-medium-font-family);
|
|
189
|
+
font-size: var(--h6-medium-font-size);
|
|
190
|
+
font-style: var(--h6-medium-font-style);
|
|
191
|
+
font-weight: var(--h6-medium-font-weight);
|
|
192
|
+
letter-spacing: var(--h6-medium-letter-spacing);
|
|
193
|
+
line-height: var(--h6-medium-line-height);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.primary-button.small .button {
|
|
197
|
+
font-family: var(--b1-medium-font-family);
|
|
198
|
+
font-size: var(--b1-medium-font-size);
|
|
199
|
+
font-style: var(--b1-medium-font-style);
|
|
200
|
+
font-weight: var(--b1-medium-font-weight);
|
|
201
|
+
letter-spacing: var(--b1-medium-letter-spacing);
|
|
202
|
+
line-height: var(--b1-medium-line-height);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.primary-button.medium .button {
|
|
206
|
+
font-family: var(--b1-medium-font-family);
|
|
207
|
+
font-size: var(--b1-medium-font-size);
|
|
208
|
+
font-style: var(--b1-medium-font-style);
|
|
209
|
+
font-weight: var(--b1-medium-font-weight);
|
|
210
|
+
letter-spacing: var(--b1-medium-letter-spacing);
|
|
211
|
+
line-height: var(--b1-medium-line-height);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.primary-button.disabled .button {
|
|
215
|
+
color: #e7e7e7;
|
|
216
|
+
}
|
|
217
|
+
.primary-button.disabled .icon { color: #e7e7e7; }
|
|
218
|
+
|
|
219
|
+
.primary-button.hover.galliano .button {
|
|
220
|
+
color: #3d230b;
|
|
221
|
+
}
|
|
222
|
+
.primary-button.hover.galliano .icon { color: #3d230b; }
|
|
223
|
+
|
|
224
|
+
.primary-button.pressing.galliano .button {
|
|
225
|
+
color: #f1f1f1;
|
|
226
|
+
}
|
|
227
|
+
.primary-button.pressing.galliano .icon { color: #f1f1f1; }
|
|
228
|
+
|
|
229
|
+
.primary-button.hover.black .button {
|
|
230
|
+
color: #f1f1f1;
|
|
231
|
+
}
|
|
232
|
+
.primary-button.hover.black .icon { color: #f1f1f1; }
|
|
233
|
+
|
|
234
|
+
.primary-button.red.default .button {
|
|
235
|
+
color: #fff1f1;
|
|
236
|
+
}
|
|
237
|
+
.primary-button.red.default .icon { color: #fff1f1; }
|
|
238
|
+
|
|
239
|
+
.primary-button.default.mauve .button {
|
|
240
|
+
color: #3d3d3d;
|
|
241
|
+
}
|
|
242
|
+
.primary-button.default.mauve .icon { color: #3d3d3d; }
|
|
243
|
+
|
|
244
|
+
.primary-button.default.olive .button {
|
|
245
|
+
color: #f3f7ee;
|
|
246
|
+
}
|
|
247
|
+
.primary-button.default.olive .icon { color: #f3f7ee; }
|
|
248
|
+
|
|
249
|
+
.primary-button.default.black .button {
|
|
250
|
+
color: #f1f1f1;
|
|
251
|
+
}
|
|
252
|
+
.primary-button.default.black .icon { color: #f1f1f1; }
|
|
253
|
+
|
|
254
|
+
.primary-button.lime.hover .button {
|
|
255
|
+
color: #3d3d3d;
|
|
256
|
+
}
|
|
257
|
+
.primary-button.lime.hover .icon { color: #3d3d3d; }
|
|
258
|
+
|
|
259
|
+
.primary-button.lime.pressing .button {
|
|
260
|
+
color: #f1f1f1;
|
|
261
|
+
}
|
|
262
|
+
.primary-button.lime.pressing .icon { color: #f1f1f1; }
|
|
263
|
+
|
|
264
|
+
.primary-button.hover.blue .button {
|
|
265
|
+
color: #f1f1f1;
|
|
266
|
+
}
|
|
267
|
+
.primary-button.hover.blue .icon { color: #f1f1f1; }
|
|
268
|
+
|
|
269
|
+
.primary-button.pressing.blue .button {
|
|
270
|
+
color: #f1f1f1;
|
|
271
|
+
}
|
|
272
|
+
.primary-button.pressing.blue .icon { color: #f1f1f1; }
|
|
273
|
+
|
|
274
|
+
.primary-button.pressing.black .button {
|
|
275
|
+
color: #f1f1f1;
|
|
276
|
+
}
|
|
277
|
+
.primary-button.pressing.black .icon { color: #f1f1f1; }
|
|
278
|
+
|
|
279
|
+
.primary-button.lime.default .button {
|
|
280
|
+
color: #3d3d3d;
|
|
281
|
+
}
|
|
282
|
+
.primary-button.lime.default .icon { color: #3d3d3d; }
|
|
283
|
+
|
|
284
|
+
.primary-button.default.blue .button {
|
|
285
|
+
color: #f1f1f1;
|
|
286
|
+
}
|
|
287
|
+
.primary-button.default.blue .icon { color: #f1f1f1; }
|
|
288
|
+
|
|
289
|
+
.primary-button.galliano.default .button {
|
|
290
|
+
color: #3d230b;
|
|
291
|
+
}
|
|
292
|
+
.primary-button.galliano.default .icon { color: #3d230b; }
|
|
293
|
+
|
|
294
|
+
.primary-button.hover.orange .button {
|
|
295
|
+
color: #f1f1f1;
|
|
296
|
+
}
|
|
297
|
+
.primary-button.hover.orange .icon { color: #f1f1f1; }
|
|
298
|
+
|
|
299
|
+
.primary-button.pressing.orange .button {
|
|
300
|
+
color: #f1f1f1;
|
|
301
|
+
}
|
|
302
|
+
.primary-button.pressing.orange .icon { color: #f1f1f1; }
|
|
303
|
+
|
|
304
|
+
.primary-button.zest.pressing .button {
|
|
305
|
+
color: #f1f1f1;
|
|
306
|
+
}
|
|
307
|
+
.primary-button.zest.pressing .icon { color: #f1f1f1; }
|
|
308
|
+
|
|
309
|
+
.primary-button.zest.hover .button {
|
|
310
|
+
color: #411607;
|
|
311
|
+
}
|
|
312
|
+
.primary-button.zest.hover .icon { color: #411607; }
|
|
313
|
+
|
|
314
|
+
.primary-button.pressing.olive .button {
|
|
315
|
+
color: #f3f7ee;
|
|
316
|
+
}
|
|
317
|
+
.primary-button.pressing.olive .icon { color: #f3f7ee; }
|
|
318
|
+
|
|
319
|
+
.primary-button.hover.olive .button {
|
|
320
|
+
color: #f3f7ee;
|
|
321
|
+
}
|
|
322
|
+
.primary-button.hover.olive .icon { color: #f3f7ee; }
|
|
323
|
+
|
|
324
|
+
.primary-button.default.green .button {
|
|
325
|
+
color: #f1f1f1;
|
|
326
|
+
}
|
|
327
|
+
.primary-button.default.green .icon { color: #f1f1f1; }
|
|
328
|
+
|
|
329
|
+
.primary-button.hover.green .button {
|
|
330
|
+
color: #f1f1f1;
|
|
331
|
+
}
|
|
332
|
+
.primary-button.hover.green .icon { color: #f1f1f1; }
|
|
333
|
+
|
|
334
|
+
.primary-button.pressing.green .button {
|
|
335
|
+
color: #f1f1f1;
|
|
336
|
+
}
|
|
337
|
+
.primary-button.pressing.green .icon { color: #f1f1f1; }
|
|
338
|
+
|
|
339
|
+
.primary-button.red.pressing .button {
|
|
340
|
+
color: #fff1f1;
|
|
341
|
+
}
|
|
342
|
+
.primary-button.red.pressing .icon { color: #fff1f1; }
|
|
343
|
+
|
|
344
|
+
.primary-button.hover.mauve .button {
|
|
345
|
+
color: #3d3d3d;
|
|
346
|
+
}
|
|
347
|
+
.primary-button.hover.mauve .icon { color: #3d3d3d; }
|
|
348
|
+
|
|
349
|
+
.primary-button.red.hover .button {
|
|
350
|
+
color: #fff1f1;
|
|
351
|
+
}
|
|
352
|
+
.primary-button.red.hover .icon { color: #fff1f1; }
|
|
353
|
+
|
|
354
|
+
.primary-button.default.orange .button {
|
|
355
|
+
color: #fff5ed;
|
|
356
|
+
}
|
|
357
|
+
.primary-button.default.orange .icon { color: #fff5ed; }
|
|
358
|
+
|
|
359
|
+
.primary-button.zest.default .button {
|
|
360
|
+
color: #411607;
|
|
361
|
+
}
|
|
362
|
+
.primary-button.zest.default .icon { color: #411607; }
|
|
363
|
+
|
|
364
|
+
.primary-button.pressing.mauve .button {
|
|
365
|
+
color: #f1f1f1;
|
|
366
|
+
}
|
|
367
|
+
.primary-button.pressing.mauve .icon { color: #f1f1f1; }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import "./style.css";
|
|
3
|
+
interface Props {
|
|
4
|
+
text?: string;
|
|
5
|
+
leftIcon?: React.JSX.Element;
|
|
6
|
+
rightIcon?: React.JSX.Element;
|
|
7
|
+
size?: "large" | "medium" | "small";
|
|
8
|
+
color: "mauve" | "lime" | "olive" | "black" | "zest" | "blue" | "orange" | "galliano" | "green" | "red";
|
|
9
|
+
status?: "pressing" | "disabled" | "hover" | "default";
|
|
10
|
+
className?: any;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const SecondaryButton: {
|
|
14
|
+
({ text, leftIcon, rightIcon, size, color, status, className, onClick, }: Props): React.JSX.Element;
|
|
15
|
+
propTypes: {
|
|
16
|
+
text: PropTypes.Requireable<string>;
|
|
17
|
+
leftIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
18
|
+
rightIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
19
|
+
size: PropTypes.Requireable<string>;
|
|
20
|
+
color: PropTypes.Requireable<string>;
|
|
21
|
+
status: PropTypes.Requireable<string>;
|
|
22
|
+
className: PropTypes.Requireable<any>;
|
|
23
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { useReducer } from "react";
|
|
4
|
+
import "./style.css";
|
|
5
|
+
export const SecondaryButton = ({ text, leftIcon, rightIcon, size, color, status, className, onClick, }) => {
|
|
6
|
+
const [state, dispatch] = useReducer(reducer, {
|
|
7
|
+
size: size || "large",
|
|
8
|
+
color: color || "black",
|
|
9
|
+
status: status || "default",
|
|
10
|
+
});
|
|
11
|
+
return (_jsxs("div", { className: `secondary-button ${state.size} ${state.color} ${state.status} ${className}`, onClick: onClick, onMouseLeave: () => {
|
|
12
|
+
dispatch("mouse_leave");
|
|
13
|
+
}, onMouseEnter: () => {
|
|
14
|
+
dispatch("mouse_enter");
|
|
15
|
+
}, children: [leftIcon && (_jsx("span", { className: `${state.size === "small" ? "class icon" : "class-2 icon"}`, children: leftIcon })), text && _jsx("div", { className: "button", children: text }), rightIcon && (_jsx("span", { className: `${state.size === "small" ? "class icon" : "class-2 icon"}`, children: rightIcon }))] }));
|
|
16
|
+
};
|
|
17
|
+
function reducer(state, action) {
|
|
18
|
+
switch (action) {
|
|
19
|
+
case "mouse_enter":
|
|
20
|
+
return {
|
|
21
|
+
...state,
|
|
22
|
+
status: "hover",
|
|
23
|
+
};
|
|
24
|
+
case "mouse_leave":
|
|
25
|
+
return {
|
|
26
|
+
...state,
|
|
27
|
+
status: "default",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return state;
|
|
31
|
+
}
|
|
32
|
+
SecondaryButton.propTypes = {
|
|
33
|
+
text: PropTypes.string,
|
|
34
|
+
leftIcon: PropTypes.node,
|
|
35
|
+
rightIcon: PropTypes.node,
|
|
36
|
+
size: PropTypes.oneOf(["large", "medium", "small"]),
|
|
37
|
+
color: PropTypes.oneOf([
|
|
38
|
+
"mauve",
|
|
39
|
+
"lime",
|
|
40
|
+
"olive",
|
|
41
|
+
"black",
|
|
42
|
+
"zest",
|
|
43
|
+
"blue",
|
|
44
|
+
"orange",
|
|
45
|
+
"galliano",
|
|
46
|
+
"green",
|
|
47
|
+
"red",
|
|
48
|
+
]),
|
|
49
|
+
status: PropTypes.oneOf(["pressing", "disabled", "hover", "default"]),
|
|
50
|
+
className: PropTypes.any,
|
|
51
|
+
onClick: PropTypes.func,
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SecondaryButton } from "./SecondaryButton";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SecondaryButton } from "./SecondaryButton";
|