@rabbitio/ui-kit 1.0.0-alpha.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.
@@ -0,0 +1,212 @@
1
+ @import "../../../../styles/index";
2
+
3
+ .button {
4
+ @extend %text-very-bold;
5
+ @extend %hover-state;
6
+ transition-property: all;
7
+ transition-duration: 0.1s;
8
+ font-size: 16px;
9
+ -webkit-border-radius: 200px;
10
+ -moz-border-radius: 200px;
11
+ border-radius: 200px;
12
+ display: inline-flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ text-decoration: none;
16
+ white-space: nowrap;
17
+ position: relative;
18
+ user-select: none;
19
+
20
+ &.disable {
21
+ &,
22
+ &:hover,
23
+ &:active {
24
+ background-color: LightColor("grey-20") !important;
25
+ color: SolidColor("grey") !important;
26
+ cursor: default !important;
27
+ box-shadow: none !important;
28
+ }
29
+ }
30
+
31
+ @media (max-width: $tablet-width) {
32
+ &.full-width-on-tablets {
33
+ max-width: 100%;
34
+ width: 100%;
35
+ }
36
+ }
37
+
38
+ @media (max-width: $phone-width) {
39
+ font-size: 14px;
40
+ &.full-width-on-mobiles {
41
+ max-width: 100%;
42
+ width: 100%;
43
+ }
44
+ }
45
+
46
+ &.xl {
47
+ height: 66px;
48
+ padding: 0 64px;
49
+ @media (max-width: $phone-width) {
50
+ height: 48px;
51
+ padding: 0;
52
+ }
53
+ }
54
+
55
+ &.lg {
56
+ font-size: 14px;
57
+ height: 48px;
58
+ padding: 0 48px;
59
+ @media (max-width: $phone-width) {
60
+ height: 40px;
61
+ }
62
+ }
63
+ &.md {
64
+ height: 40px;
65
+ font-size: 14px;
66
+ padding: 0 32px;
67
+ }
68
+ &.sm {
69
+ height: 35px;
70
+ font-size: 12px;
71
+ padding: 0 24px;
72
+
73
+ // This is somewhat of a hack, which should absolutely be refactored with a better layout
74
+ &.small-padding-on-small-mobiles {
75
+ @media (max-width: 415px) {
76
+ padding: 0 18px;
77
+ }
78
+ }
79
+ }
80
+
81
+ &.primary {
82
+ box-shadow: 0 20px 40px 0 rgba(11, 137, 143, 0.39);
83
+ background: SolidColor(tosca);
84
+ color: $white;
85
+ }
86
+
87
+ &.primary-bordered {
88
+ border: $buttonBorder;
89
+ color: SolidColor(tosca);
90
+ &:hover {
91
+ background-color: LightColor("tosca-20");
92
+ transition-duration: 0.02s;
93
+ opacity: 1;
94
+ }
95
+ }
96
+
97
+ &.primary-transparent {
98
+ background: LightColor(army-20);
99
+ color: SolidColor(tosca);
100
+ }
101
+
102
+ &.transparent {
103
+ background: LightColor(white-20);
104
+ color: $white;
105
+ box-shadow: 0 23px 30px 0 rgba(0, 102, 107, 0.39);
106
+ }
107
+
108
+ &.transparent-bordered {
109
+ border: $buttonBorderWhite;
110
+ color: $white;
111
+ }
112
+
113
+ &.transparent-without-shadow {
114
+ background: transparent;
115
+ border-color: transparent;
116
+ color: SolidColor(tosca);
117
+ }
118
+
119
+ &.white {
120
+ background: $white;
121
+ color: #39448e;
122
+ box-shadow: 0 20px 20px rgba(15, 24, 75, 0.2);
123
+ }
124
+
125
+ &-primary-dots-wrapper {
126
+ position: absolute;
127
+ top: 50%;
128
+ left: 50%;
129
+ transform: translate(-50%, -50%) scale(1.15);
130
+ transition: all 0.1s $transitionEaseOut;
131
+ opacity: 0;
132
+
133
+ &.show {
134
+ opacity: 1;
135
+ transform: translate(-50%, -50%) scale(1);
136
+ }
137
+ }
138
+
139
+ &-success-icon {
140
+ position: absolute;
141
+ top: 50%;
142
+ left: 50%;
143
+ opacity: 0;
144
+ width: 20px;
145
+ height: 20px;
146
+ transform: translate(-50%, -50%) scale(1.4);
147
+ transition: all 0.1s $transitionEaseOut;
148
+ display: flex;
149
+ justify-content: center;
150
+ align-items: center;
151
+
152
+ &.show {
153
+ opacity: 1;
154
+ transform: translate(-50%, -50%) scale(1);
155
+ }
156
+
157
+ &::after {
158
+ content: " ";
159
+ display: inline-block;
160
+ transform: rotate(45deg);
161
+ height: 10px;
162
+ width: 5px;
163
+ border-bottom: 3px solid SolidColor(tosca);
164
+ border-right: 3px solid SolidColor(tosca);
165
+ margin-top: -4px;
166
+ }
167
+
168
+ &.transparent-bordered::after,
169
+ &.transparent::after,
170
+ &.primary::after {
171
+ border-color: $white;
172
+ }
173
+
174
+ &.primary-bordered::after,
175
+ &.primary-transparent::after,
176
+ &.transparent-without-shadow::after {
177
+ border-color: SolidColor(tosca);
178
+ }
179
+ }
180
+
181
+ &-text {
182
+ user-select: none;
183
+ transform: scale(1);
184
+ transition: all 0.1s $transitionEaseOut;
185
+ &.hide {
186
+ opacity: 0;
187
+ transform: scale(0.9);
188
+ }
189
+ }
190
+
191
+ .button-with-icon {
192
+ display: flex;
193
+ align-items: center;
194
+ transform: scale(1);
195
+ transition: all 0.1s $transitionEaseOut;
196
+
197
+ &.hide {
198
+ opacity: 0;
199
+ transform: scale(0.9);
200
+ }
201
+
202
+ &-text {
203
+ margin-left: Margin("3");
204
+ }
205
+
206
+ &.big-icon {
207
+ img {
208
+ height: 24px;
209
+ }
210
+ }
211
+ }
212
+ }
@@ -0,0 +1,286 @@
1
+ import React from "react";
2
+ import Button from "./Button.js";
3
+ import icon from "../../../assets/icons/transactions-icon.svg";
4
+
5
+ const sizes = ["xl", "lg", "md", "sm"];
6
+ const modes = [
7
+ "transparent",
8
+ "white",
9
+ "primary",
10
+ "primary-bordered",
11
+ "primary-transparent",
12
+ "transparent-bordered",
13
+ "transparent-without-shadow",
14
+ ];
15
+
16
+ export default {
17
+ title: "Button",
18
+ component: Button,
19
+ parameters: {
20
+ viewport: {
21
+ defaultViewport: "reset",
22
+ },
23
+ backgrounds: {
24
+ default: "dark",
25
+ },
26
+ },
27
+ argTypes: {
28
+ size: {
29
+ control: { type: "select", options: sizes },
30
+ },
31
+ content: { control: "text" },
32
+ className: { table: { disable: true } },
33
+ onClick: { table: { disable: true } },
34
+ to: { table: { disable: true } },
35
+ icon: { table: { disable: true } },
36
+ setClickTrigger: { table: { disable: true } },
37
+ isFormSubmittingButton: { table: { disable: true } },
38
+ propagatePrimaryButtonClick: { table: { disable: true } },
39
+ handleError: { table: { disable: true } },
40
+ },
41
+ tags: ["autodocs"],
42
+ };
43
+
44
+ const ModeStory = ({ mode }) => (
45
+ <>
46
+ {sizes.map((size) => (
47
+ <div key={size} style={{ marginBottom: "10px" }}>
48
+ <Button
49
+ size={size}
50
+ mode={mode}
51
+ content={`${
52
+ mode.charAt(0).toUpperCase() + mode.slice(1)
53
+ } ${size.toUpperCase()} Button`}
54
+ />
55
+ </div>
56
+ ))}
57
+ </>
58
+ );
59
+
60
+ const Template = (args) => <Button {...args} />;
61
+
62
+ export const Default = Template.bind({});
63
+ Default.args = { content: "Button" };
64
+
65
+ export const Transparent = () => <ModeStory mode="transparent" />;
66
+
67
+ export const White = () => <ModeStory mode="white" />;
68
+
69
+ export const Primary = () => <ModeStory mode="primary" />;
70
+
71
+ export const PrimaryBordered = () => <ModeStory mode="primary-bordered" />;
72
+
73
+ export const PrimaryTransparent = () => (
74
+ <ModeStory mode="primary-transparent" />
75
+ );
76
+
77
+ export const TransparentBordered = () => (
78
+ <ModeStory mode="transparent-bordered" />
79
+ );
80
+
81
+ export const TransparentWithoutShadow = () => (
82
+ <ModeStory mode="transparent-without-shadow" />
83
+ );
84
+
85
+ // TODO: [dev] requires fix
86
+ // export const LinkButton = () => (
87
+ // <>
88
+ // <h3>Link Button</h3>
89
+ // {sizes.map((size) => (
90
+ // <div key={size} style={{ marginBottom: "10px" }}>
91
+ // <Button
92
+ // size={size}
93
+ // mode="primary"
94
+ // content={`Link ${size.toUpperCase()} Button`}
95
+ // to="/example-path"
96
+ // />
97
+ // </div>
98
+ // ))}
99
+ // </>
100
+ // );
101
+
102
+ export const LoadingButton = () => (
103
+ <>
104
+ <h3>Loading Button</h3>
105
+ {sizes.map((size) => (
106
+ <div key={size} style={{ marginBottom: "10px" }}>
107
+ <Button
108
+ size={size}
109
+ mode="primary"
110
+ content={`Loading ${size.toUpperCase()} Button`}
111
+ loader={true}
112
+ loading={true}
113
+ />
114
+ </div>
115
+ ))}
116
+ </>
117
+ );
118
+
119
+ export const IconButton = () => (
120
+ <>
121
+ <h3>Button with Icon</h3>
122
+ {modes.map((mode) => (
123
+ <div key={mode} style={{ marginBottom: "20px" }}>
124
+ <h4>Mode: {mode.charAt(0).toUpperCase() + mode.slice(1)}</h4>
125
+ {sizes.map((size) => (
126
+ <div key={size} style={{ marginBottom: "10px" }}>
127
+ <Button
128
+ size={size}
129
+ mode={mode}
130
+ icon={icon}
131
+ content={`${
132
+ mode.charAt(0).toUpperCase() + mode.slice(1)
133
+ } ${size.toUpperCase()} Button with Icon`}
134
+ />
135
+ </div>
136
+ ))}
137
+ </div>
138
+ ))}
139
+ </>
140
+ );
141
+
142
+ export const DisabledButton = () => (
143
+ <>
144
+ <h3>Disabled Button</h3>
145
+ {sizes.map((size) => (
146
+ <div
147
+ key={size}
148
+ style={{
149
+ marginBottom: "10px",
150
+ display: "flex",
151
+ justifyContent: "space-between",
152
+ }}
153
+ >
154
+ <Button
155
+ size={size}
156
+ mode={"primary"}
157
+ content={`${size.toUpperCase()} Button`}
158
+ isDisabled={true}
159
+ />
160
+ <div style={{ marginRight: "10px" }} />
161
+ <Button
162
+ size={size}
163
+ mode={"primary"}
164
+ icon={icon}
165
+ content={`${size.toUpperCase()} Button with Icon`}
166
+ isDisabled={true}
167
+ />
168
+ </div>
169
+ ))}
170
+ </>
171
+ );
172
+
173
+ export const CheckmarkOnClickButton = () => (
174
+ <>
175
+ <h3>Button with Checkmark on Click</h3>
176
+ {modes.map((mode) => (
177
+ <div key={mode} style={{ marginBottom: "10px" }}>
178
+ <Button
179
+ size={"xl"}
180
+ mode={mode}
181
+ content={`${
182
+ mode.charAt(0).toUpperCase() + mode.slice(1)
183
+ } XL Button`}
184
+ checkmarkOnClick={true}
185
+ loader={false}
186
+ />
187
+ </div>
188
+ ))}
189
+ </>
190
+ );
191
+
192
+ export const BigIconButton = () => (
193
+ <>
194
+ <h3>Button with Big Icon</h3>
195
+ {modes.map((mode) => (
196
+ <div key={mode} style={{ marginBottom: "20px" }}>
197
+ <h4>Mode: {mode.charAt(0).toUpperCase() + mode.slice(1)}</h4>
198
+ {sizes.map((size) => (
199
+ <div key={size} style={{ marginBottom: "10px" }}>
200
+ <Button
201
+ size={size}
202
+ mode={mode}
203
+ icon={icon}
204
+ content={`${
205
+ mode.charAt(0).toUpperCase() + mode.slice(1)
206
+ } ${size.toUpperCase()} Button with Big Icon`}
207
+ bigIcon={true}
208
+ />
209
+ </div>
210
+ ))}
211
+ </div>
212
+ ))}
213
+ </>
214
+ );
215
+
216
+ export const FullWidthOnMobiles = () => (
217
+ <>
218
+ <h3>Full Width on Mobiles</h3>
219
+ {modes.map((mode) => (
220
+ <div key={mode} style={{ marginBottom: "10px" }}>
221
+ <Button
222
+ mode={mode}
223
+ content={`Full Width Mobile ${
224
+ mode.charAt(0).toUpperCase() + mode.slice(1)
225
+ } Button`}
226
+ fullWidthOnMobiles={true}
227
+ />
228
+ </div>
229
+ ))}
230
+ </>
231
+ );
232
+ FullWidthOnMobiles.parameters = {
233
+ viewport: {
234
+ defaultViewport: "iphone14promax",
235
+ },
236
+ };
237
+
238
+ export const FullWidthOnTablets = () => (
239
+ <>
240
+ <h3>Full Width on Tablets</h3>
241
+ {modes.map((mode) => (
242
+ <div key={mode} style={{ marginBottom: "10px" }}>
243
+ <Button
244
+ mode={mode}
245
+ content={`Full Width Tablet ${
246
+ mode.charAt(0).toUpperCase() + mode.slice(1)
247
+ } Button`}
248
+ fullWidthOnTablets={true}
249
+ />
250
+ </div>
251
+ ))}
252
+ </>
253
+ );
254
+ FullWidthOnTablets.parameters = {
255
+ viewport: {
256
+ defaultViewport: "ipad",
257
+ },
258
+ };
259
+
260
+ export const SmallPaddingOnSmallMobilesButton = () => (
261
+ <>
262
+ <h3>Button with Small Padding on Small Mobiles</h3>
263
+ {modes.map((mode) => (
264
+ <div key={mode} style={{ marginBottom: "20px" }}>
265
+ <h4>Mode: {mode.charAt(0).toUpperCase() + mode.slice(1)}</h4>
266
+ {sizes.map((size) => (
267
+ <div key={size} style={{ marginBottom: "10px" }}>
268
+ <Button
269
+ size={size}
270
+ mode={mode}
271
+ content={`${
272
+ mode.charAt(0).toUpperCase() + mode.slice(1)
273
+ } ${size.toUpperCase()} Button`}
274
+ smallPaddingOnSmallMobiles={true}
275
+ />
276
+ </div>
277
+ ))}
278
+ </div>
279
+ ))}
280
+ </>
281
+ );
282
+ SmallPaddingOnSmallMobilesButton.parameters = {
283
+ viewport: {
284
+ defaultViewport: "iphone14",
285
+ },
286
+ };
@@ -0,0 +1,2 @@
1
+ export { default as Button } from "./atoms/buttons/Button/Button";
2
+ export { default as LoadingDots } from "./atoms/LoadingDots/LoadingDots";
@@ -0,0 +1,15 @@
1
+ @function SolidColor($color) {
2
+ @return map_get($solidColor, $color);
3
+ }
4
+
5
+ @function LightColor($color) {
6
+ @return map_get($lightColor, $color);
7
+ }
8
+
9
+ @function Margin($marginSize) {
10
+ @return map_get($margin-sizes, $marginSize);
11
+ }
12
+
13
+ @function Padding($paddingSize) {
14
+ @return map_get($padding-sizes, $paddingSize);
15
+ }