Skip to content

Commit

Permalink
feat: Success Button (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored Sep 15, 2020
1 parent e2f1d06 commit d35f7b3
Show file tree
Hide file tree
Showing 22 changed files with 85 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/fuselage/src/components/Button/ActionButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';

import { Button } from '.';
import { Icon } from '../Icon';

export const ActionButton = ({ icon, ...props }) => <Button {...props} square small flexShrink={0}><Icon name={icon} size='x20'/></Button>;
14 changes: 14 additions & 0 deletions packages/fuselage/src/components/Button/Button.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ Indicates an actionable user action.
</Story>
</Canvas>

### Success

<Canvas>
<Story name='Success'>
<Button success>Button</Button>
</Story>
</Canvas>

### Danger

<Canvas>
Expand Down Expand Up @@ -93,6 +101,7 @@ Indicates an actionable user action.
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x20' /> },
'text + icon': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</> },
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</>, danger: true },
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
}}
yAxis={{
default: {},
Expand All @@ -115,6 +124,7 @@ Indicates an actionable user action.
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x16' /> },
'text + icon': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</> },
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, danger: true },
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
}}
yAxis={{
default: {},
Expand All @@ -137,6 +147,7 @@ Indicates an actionable user action.
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x20' /> },
'text + icon': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</> },
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</>, danger: true },
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
}}
yAxis={{
default: {},
Expand All @@ -159,6 +170,7 @@ Indicates an actionable user action.
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x16' /> },
'text + icon': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</> },
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, danger: true },
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
}}
yAxis={{
default: {},
Expand All @@ -181,6 +193,7 @@ Indicates an actionable user action.
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x20' /> },
'text + icon': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</> },
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x16' /> Button</>, danger: true },
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
}}
yAxis={{
default: {},
Expand All @@ -203,6 +216,7 @@ Indicates an actionable user action.
'square + icon': { square: true, children: <Icon name='circled-arrow-down' size='x16' /> },
'text + icon': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</> },
'text + icon + danger': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, danger: true },
'text + icon + success': { children: <><Icon name='circled-arrow-down' size='x12' /> Button</>, success: true },
}}
yAxis={{
default: {},
Expand Down
4 changes: 4 additions & 0 deletions packages/fuselage/src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Box } from '../Box';

export const Button = forwardRef(function Button({
danger,
success,
external,
ghost,
is = 'button',
Expand All @@ -27,10 +28,13 @@ export const Button = forwardRef(function Button({
is={is}
rcx-button
rcx-button--danger={!primary && danger && !ghost}
rcx-button--success={!primary && success && !ghost}
rcx-button--ghost={!primary && !danger && ghost}
rcx-button--ghost-danger={!primary && danger && ghost}
rcx-button--ghost-success={!primary && success && ghost}
rcx-button--primary={primary && !danger && !ghost}
rcx-button--primary-danger={primary && danger && !ghost}
rcx-button--primary-success={primary && success && !ghost}
rcx-button--small={small}
rcx-button--square={square}
rcx-button--small-square={small && square}
Expand Down
24 changes: 24 additions & 0 deletions packages/fuselage/src/components/Button/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@
);
}

&--success {
color: colors.success(500);

&.disabled,
&:disabled {
color: colors.success(100);
}
}

&--danger {
color: colors.danger(500);

Expand All @@ -103,6 +112,10 @@
@extend %button--danger;
}

&--primary-success {
@extend %button--success;
}

&--ghost {
border-color: transparent;
background-color: transparent;
Expand All @@ -118,4 +131,15 @@
color: colors.danger(100);
}
}

&--ghost-success {
color: colors.success(500);
border-color: transparent;
background-color: transparent;

&.disabled,
&:disabled {
color: colors.success(100);
}
}
}
4 changes: 4 additions & 0 deletions packages/fuselage/src/components/ButtonGroup/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
}
}

.rcx-button-group.rcx-button-group--small > & {
margin-inline: lengths.margin(2);
}

.rcx-button-group--wrap > & {
margin-block-end: lengths.margin(16);
margin-inline-start: lengths.margin(none);
Expand Down
1 change: 1 addition & 0 deletions packages/fuselage/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './Avatar';
export * from './Badge';
export * from './Box';
export * from './Button';
export * from './Button/ActionButton';
export * from './ButtonGroup';
export * from './Callout';
export * from './CheckBox';
Expand Down
18 changes: 18 additions & 0 deletions packages/fuselage/src/styles/primitives/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,24 @@
);
}

%button--success {
@include as-button(
$background-color: $button-colors-success-background-color,
$border-color: $button-colors-success-border-color,
$color: $button-colors-success-color,
$hover-background-color: $button-colors-success-hover-background-color,
$hover-border-color: $button-colors-success-hover-border-color,
$active-background-color: $button-colors-success-active-background-color,
$active-border-color: $button-colors-success-active-border-color,
$focus-background-color: $button-colors-success-focus-background-color,
$focus-border-color: $button-colors-success-focus-border-color,
$focus-shadow-color: $button-colors-success-focus-shadow-color,
$disabled-background-color: $button-colors-success-disabled-background-color,
$disabled-border-color: $button-colors-success-disabled-border-color,
$disabled-color: $button-colors-success-disabled-color,
);
}

%button--danger {
@include as-button(
$background-color: $button-colors-danger-background-color,
Expand Down
14 changes: 14 additions & 0 deletions packages/fuselage/src/styles/variables/button-colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ $button-colors-secondary-disabled-background-color: theme('button-colors-seconda
$button-colors-secondary-disabled-border-color: theme('button-colors-secondary-disabled-border-color', colors.neutral(100));
$button-colors-secondary-disabled-color: theme('button-colors-secondary-disabled-color', colors.neutral(400));

$button-colors-success-background-color: theme('button-colors-success-background-color', colors.success(500));
$button-colors-success-border-color: theme('button-colors-success-border-color', colors.success(500));
$button-colors-success-color: theme('button-colors-success-color', colors.foreground(alternative));
$button-colors-success-hover-background-color: theme('button-colors-success-hover-background-color', colors.success(600));
$button-colors-success-hover-border-color: theme('button-colors-success-hover-border-color', colors.success(600));
$button-colors-success-active-background-color: theme('button-colors-success-active-background-color', colors.success(700));
$button-colors-success-active-border-color: theme('button-colors-success-active-border-color', colors.success(700));
$button-colors-success-focus-background-color: theme('button-colors-success-focus-background-color', colors.success(500));
$button-colors-success-focus-border-color: theme('button-colors-success-focus-border-color', colors.success(700));
$button-colors-success-focus-shadow-color: theme('button-colors-success-focus-shadow-color', colors.success(100));
$button-colors-success-disabled-background-color: theme('button-colors-success-disabled-background-color', colors.success(200));
$button-colors-success-disabled-border-color: theme('button-colors-success-disabled-border-color', colors.success(200));
$button-colors-success-disabled-color: theme('button-colors-success-disabled-color', colors.foreground(alternative));

$button-colors-danger-background-color: theme('button-colors-danger-background-color', colors.danger(500));
$button-colors-danger-border-color: theme('button-colors-danger-border-color', colors.danger(500));
$button-colors-danger-color: theme('button-colors-danger-color', colors.foreground(alternative));
Expand Down

0 comments on commit d35f7b3

Please sign in to comment.