Skip to content

Commit d35f7b3

Browse files
authored
feat: Success Button (#283)
1 parent e2f1d06 commit d35f7b3

22 files changed

+85
-0
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
3+
import { Button } from '.';
4+
import { Icon } from '../Icon';
5+
6+
export const ActionButton = ({ icon, ...props }) => <Button {...props} square small flexShrink={0}><Icon name={icon} size='x20'/></Button>;

packages/fuselage/src/components/Button/Button.stories.mdx

+14
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ Indicates an actionable user action.
3636
</Story>
3737
</Canvas>
3838

39+
### Success
40+
41+
<Canvas>
42+
<Story name='Success'>
43+
<Button success>Button</Button>
44+
</Story>
45+
</Canvas>
46+
3947
### Danger
4048

4149
<Canvas>
@@ -93,6 +101,7 @@ Indicates an actionable user action.
93101
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x20' /> },
94102
'text + icon': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</> },
95103
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</>, danger: true },
104+
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
96105
}}
97106
yAxis={{
98107
default: {},
@@ -115,6 +124,7 @@ Indicates an actionable user action.
115124
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x16' /> },
116125
'text + icon': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</> },
117126
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, danger: true },
127+
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
118128
}}
119129
yAxis={{
120130
default: {},
@@ -137,6 +147,7 @@ Indicates an actionable user action.
137147
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x20' /> },
138148
'text + icon': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</> },
139149
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</>, danger: true },
150+
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
140151
}}
141152
yAxis={{
142153
default: {},
@@ -159,6 +170,7 @@ Indicates an actionable user action.
159170
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x16' /> },
160171
'text + icon': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</> },
161172
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, danger: true },
173+
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
162174
}}
163175
yAxis={{
164176
default: {},
@@ -181,6 +193,7 @@ Indicates an actionable user action.
181193
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x20' /> },
182194
'text + icon': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</> },
183195
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</>, danger: true },
196+
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
184197
}}
185198
yAxis={{
186199
default: {},
@@ -203,6 +216,7 @@ Indicates an actionable user action.
203216
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x16' /> },
204217
'text + icon': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</> },
205218
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, danger: true },
219+
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
206220
}}
207221
yAxis={{
208222
default: {},

packages/fuselage/src/components/Button/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Box } from '../Box';
55

66
export const Button = forwardRef(function Button({
77
danger,
8+
success,
89
external,
910
ghost,
1011
is = 'button',
@@ -27,10 +28,13 @@ export const Button = forwardRef(function Button({
2728
is={is}
2829
rcx-button
2930
rcx-button--danger={!primary && danger && !ghost}
31+
rcx-button--success={!primary && success && !ghost}
3032
rcx-button--ghost={!primary && !danger && ghost}
3133
rcx-button--ghost-danger={!primary && danger && ghost}
34+
rcx-button--ghost-success={!primary && success && ghost}
3235
rcx-button--primary={primary && !danger && !ghost}
3336
rcx-button--primary-danger={primary && danger && !ghost}
37+
rcx-button--primary-success={primary && success && !ghost}
3438
rcx-button--small={small}
3539
rcx-button--square={square}
3640
rcx-button--small-square={small && square}

packages/fuselage/src/components/Button/styles.scss

+24
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@
8686
);
8787
}
8888

89+
&--success {
90+
color: colors.success(500);
91+
92+
&.disabled,
93+
&:disabled {
94+
color: colors.success(100);
95+
}
96+
}
97+
8998
&--danger {
9099
color: colors.danger(500);
91100

@@ -103,6 +112,10 @@
103112
@extend %button--danger;
104113
}
105114

115+
&--primary-success {
116+
@extend %button--success;
117+
}
118+
106119
&--ghost {
107120
border-color: transparent;
108121
background-color: transparent;
@@ -118,4 +131,15 @@
118131
color: colors.danger(100);
119132
}
120133
}
134+
135+
&--ghost-success {
136+
color: colors.success(500);
137+
border-color: transparent;
138+
background-color: transparent;
139+
140+
&.disabled,
141+
&:disabled {
142+
color: colors.success(100);
143+
}
144+
}
121145
}

packages/fuselage/src/components/ButtonGroup/styles.scss

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
}
5050
}
5151

52+
.rcx-button-group.rcx-button-group--small > & {
53+
margin-inline: lengths.margin(2);
54+
}
55+
5256
.rcx-button-group--wrap > & {
5357
margin-block-end: lengths.margin(16);
5458
margin-inline-start: lengths.margin(none);

packages/fuselage/src/components/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from './Avatar';
44
export * from './Badge';
55
export * from './Box';
66
export * from './Button';
7+
export * from './Button/ActionButton';
78
export * from './ButtonGroup';
89
export * from './Callout';
910
export * from './CheckBox';

packages/fuselage/src/styles/primitives/button.scss

+18
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,24 @@
8888
);
8989
}
9090

91+
%button--success {
92+
@include as-button(
93+
$background-color: $button-colors-success-background-color,
94+
$border-color: $button-colors-success-border-color,
95+
$color: $button-colors-success-color,
96+
$hover-background-color: $button-colors-success-hover-background-color,
97+
$hover-border-color: $button-colors-success-hover-border-color,
98+
$active-background-color: $button-colors-success-active-background-color,
99+
$active-border-color: $button-colors-success-active-border-color,
100+
$focus-background-color: $button-colors-success-focus-background-color,
101+
$focus-border-color: $button-colors-success-focus-border-color,
102+
$focus-shadow-color: $button-colors-success-focus-shadow-color,
103+
$disabled-background-color: $button-colors-success-disabled-background-color,
104+
$disabled-border-color: $button-colors-success-disabled-border-color,
105+
$disabled-color: $button-colors-success-disabled-color,
106+
);
107+
}
108+
91109
%button--danger {
92110
@include as-button(
93111
$background-color: $button-colors-danger-background-color,

packages/fuselage/src/styles/variables/button-colors.scss

+14
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ $button-colors-secondary-disabled-background-color: theme('button-colors-seconda
2828
$button-colors-secondary-disabled-border-color: theme('button-colors-secondary-disabled-border-color', colors.neutral(100));
2929
$button-colors-secondary-disabled-color: theme('button-colors-secondary-disabled-color', colors.neutral(400));
3030

31+
$button-colors-success-background-color: theme('button-colors-success-background-color', colors.success(500));
32+
$button-colors-success-border-color: theme('button-colors-success-border-color', colors.success(500));
33+
$button-colors-success-color: theme('button-colors-success-color', colors.foreground(alternative));
34+
$button-colors-success-hover-background-color: theme('button-colors-success-hover-background-color', colors.success(600));
35+
$button-colors-success-hover-border-color: theme('button-colors-success-hover-border-color', colors.success(600));
36+
$button-colors-success-active-background-color: theme('button-colors-success-active-background-color', colors.success(700));
37+
$button-colors-success-active-border-color: theme('button-colors-success-active-border-color', colors.success(700));
38+
$button-colors-success-focus-background-color: theme('button-colors-success-focus-background-color', colors.success(500));
39+
$button-colors-success-focus-border-color: theme('button-colors-success-focus-border-color', colors.success(700));
40+
$button-colors-success-focus-shadow-color: theme('button-colors-success-focus-shadow-color', colors.success(100));
41+
$button-colors-success-disabled-background-color: theme('button-colors-success-disabled-background-color', colors.success(200));
42+
$button-colors-success-disabled-border-color: theme('button-colors-success-disabled-border-color', colors.success(200));
43+
$button-colors-success-disabled-color: theme('button-colors-success-disabled-color', colors.foreground(alternative));
44+
3145
$button-colors-danger-background-color: theme('button-colors-danger-background-color', colors.danger(500));
3246
$button-colors-danger-border-color: theme('button-colors-danger-border-color', colors.danger(500));
3347
$button-colors-danger-color: theme('button-colors-danger-color', colors.foreground(alternative));

0 commit comments

Comments
 (0)