Skip to content

Commit

Permalink
Add and use text skin for Button component
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasnatter committed Sep 9, 2020
1 parent d51d3d9 commit 4c76c2d
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 3 deletions.
Expand Up @@ -45,6 +45,19 @@ const onClick = () => {
alert('Clicked this nice button, congrats!');
};

<Button
skin="text"
onClick={onClick}>
Click me dude
</Button>
```

```javascript
const onClick = () => {
/* do click things */
alert('Clicked this nice button, congrats!');
};

<Button
skin="icon"
icon="su-plus"
Expand Down
Expand Up @@ -17,6 +17,9 @@ $secondaryDisabledColor: $silver;
$linkColor: $black;
$linkDisabledColor: $silverChalice;

$textColor: $black;
$textDisabledColor: $silverChalice;

$iconFontSize: 14px;
$iconBackgroundColorActive: $doveGray;
$iconBackgroundColorHover: $mercury;
Expand Down Expand Up @@ -111,6 +114,28 @@ $iconColorActive: $white;
}
}

.text {
padding: 0;
border: 0;
background: transparent;
cursor: pointer;
font-size: $fontSize;
color: $textColor;

.button-icon + .text {
margin-left: 10px;
}

.dropdown-icon {
margin-left: 10px;
font-size: $dropdownFontSize;
}

&:disabled {
color: $textDisabledColor;
}
}

.icon {
background: none;
min-width: 30px;
Expand Down
Expand Up @@ -23,6 +23,10 @@ test('Should render with skin link', () => {
expect(render(<Button skin="link" />)).toMatchSnapshot();
});

test('Should render with skin text', () => {
expect(render(<Button skin="text" />)).toMatchSnapshot();
});

test('Should render with skin icon', () => {
expect(render(<Button skin="icon" />)).toMatchSnapshot();
});
Expand Down
Expand Up @@ -100,6 +100,13 @@ exports[`Should render with skin secondary and dropdown icon 1`] = `
</button>
`;

exports[`Should render with skin text 1`] = `
<button
class="button text"
type="button"
/>
`;

exports[`should render disabled with skin secondary 1`] = `
<button
class="button secondary"
Expand Down
@@ -1,3 +1,3 @@
// @flow

export type ButtonSkin = 'primary' | 'secondary' | 'link' | 'icon';
export type ButtonSkin = 'primary' | 'secondary' | 'link' | 'text' | 'icon';
Expand Up @@ -107,7 +107,7 @@ class SnippetAreas extends React.Component<ViewProps> {
<Button
className={snippetAreasStyles.titleButton}
onClick={this.handleSnippetClick}
skin="link"
skin="text"
value={defaultUuid}
>
{defaultTitle}
Expand Down
Expand Up @@ -77,7 +77,7 @@ exports[`Render snippet areas with data as table 1`] = `
class="cellContent"
>
<button
class="button link titleButton"
class="button text titleButton"
type="button"
>
<span
Expand Down

0 comments on commit 4c76c2d

Please sign in to comment.