Skip to content

style(flat-button): implement inverted tone #869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/components/buttons/flat-button/README.md
Original file line number Diff line number Diff line change
@@ -26,15 +26,15 @@ iconClass label url onClick

#### Properties

| Props | Type | Required | Values | Default | Description |
| -------------- | --------- | :------: | --------------------------- | --------- | ----------------------------------------------------- |
| `tone` | `oneOf` | - | `primary`, `secondary` | `primary` | - |
| `type` | `string` | - | `submit`, `reset`, `button` | `button` | Used as the HTML `type` attribute. |
| `label` | `string` | ✅ | - | - | Should describe what the button is for |
| `onClick` | `func` | ✅ | - | - | What the button will trigger when clicked |
| `icon` | `element` | - | - | - | The icon of the button |
| `iconPosition` | `oneOf` | - | `left`, `right` | `left` | The position of the icon |
| `isDisabled` | `boolean` | - | - | - | Tells when the button should present a disabled state |
| Props | Type | Required | Values | Default | Description |
| -------------- | --------- | :------: | ---------------------------------- | --------- | ----------------------------------------------------- |
| `tone` | `oneOf` | - | `primary`, `secondary`, `inverted` | `primary` | - |
| `type` | `string` | - | `submit`, `reset`, `button` | `button` | Used as the HTML `type` attribute. |
| `label` | `string` | ✅ | - | - | Should describe what the button is for |
| `onClick` | `func` | ✅ | - | - | What the button will trigger when clicked |
| `icon` | `element` | - | - | - | The icon of the button |
| `iconPosition` | `oneOf` | - | `left`, `right` | `left` | The position of the icon |
| `isDisabled` | `boolean` | - | - | - | Tells when the button should present a disabled state |

The component further forwards all `data-` and `aria-` attributes to the underlying `button` component.

2 changes: 2 additions & 0 deletions src/components/buttons/flat-button/flat-button.js
Original file line number Diff line number Diff line change
@@ -22,6 +22,8 @@ const getTextColor = (tone, isHover = false) => {
return isHover ? vars.colorPrimary25 : vars.colorPrimary;
case 'secondary':
return vars.colorSolid;
case 'inverted':
return vars.colorSurface;
default:
return 'inherit';
}
2 changes: 1 addition & 1 deletion src/components/buttons/flat-button/flat-button.story.js
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ storiesOf('Components|Buttons', module)
<Section>
<FlatButton
type={select('type', ['submit', 'reset', 'button'], 'button')}
tone={select('tone', ['primary', 'secondary'], 'primary')}
tone={select('tone', ['primary', 'secondary', 'inverted'], 'primary')}
label={text('label', 'Accessibility text')}
icon={React.createElement(
icons[select('icon', iconNames, iconNames[0])]