Skip to content

Commit

Permalink
Add link to selected default-snippet in SnippetAreas view (#5392)
Browse files Browse the repository at this point in the history
* Add link to selected default-snippet in StipperAreas view

* Add test case

* Adjust import in SnippetAreas.test.js

* Add and use text skin for Button component

* Rename css class of button-text to prevent conflict with skin

* Update a lot of snapshot tests
  • Loading branch information
niklasnatter committed Sep 9, 2020
1 parent 40fa173 commit 6df5665
Show file tree
Hide file tree
Showing 45 changed files with 246 additions and 160 deletions.
Expand Up @@ -73,7 +73,7 @@ exports[`Should render a block list 1`] = `
class="su-plus buttonIcon"
/>
<span
class="text"
class="buttonText"
>
Add block
</span>
Expand Down Expand Up @@ -155,7 +155,7 @@ exports[`Should render a disabled block list 1`] = `
class="su-plus buttonIcon"
/>
<span
class="text"
class="buttonText"
>
Add block
</span>
Expand Down Expand Up @@ -237,7 +237,7 @@ exports[`Should render a fully filled block list without add button if maxOccurs
class="su-plus buttonIcon"
/>
<span
class="text"
class="buttonText"
>
Add block
</span>
Expand All @@ -261,7 +261,7 @@ exports[`Should render an empty block list 1`] = `
class="su-plus buttonIcon"
/>
<span
class="text"
class="buttonText"
>
Add block
</span>
Expand Down
Expand Up @@ -92,7 +92,7 @@ export default class Button<T> extends React.PureComponent<Props<T>> {
<Icon className={iconClass} name={icon} />
}
{children &&
<span className={buttonStyles.text}>{children}</span>
<span className={buttonStyles.buttonText}>{children}</span>
}
{showDropdownIcon &&
<Icon className={buttonStyles.dropdownIcon} name="su-angle-down" />
Expand Down
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 @@ -93,11 +96,11 @@ $iconColorActive: $white;
font-size: $fontSize;
color: $linkColor;

.text {
.button-text {
text-decoration: underline;
}

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

Expand All @@ -111,6 +114,28 @@ $iconColorActive: $white;
}
}

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

.button-icon + .button-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 @@ -160,7 +185,7 @@ $iconColorActive: $white;
background-color: transparent;
border-color: transparent;

.text {
.button-text {
opacity: 0;
}

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 @@ -10,7 +10,7 @@ exports[`Should render the button with icon 1`] = `
class="su-plus buttonIcon"
/>
<span
class="text"
class="buttonText"
>
Add something
</span>
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 @@ -9,7 +9,7 @@ exports[`Should render a button and a dropdown button 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-th-large"
Expand Down Expand Up @@ -38,7 +38,7 @@ exports[`Should render a button with a custom className 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-th-large"
Expand All @@ -58,7 +58,7 @@ exports[`Should render more than two buttons 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-th-large"
Expand All @@ -71,7 +71,7 @@ exports[`Should render more than two buttons 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-align-justify"
Expand All @@ -84,7 +84,7 @@ exports[`Should render more than two buttons 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-th-large"
Expand All @@ -97,7 +97,7 @@ exports[`Should render more than two buttons 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-align-justify"
Expand All @@ -117,7 +117,7 @@ exports[`Should render one button 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-th-large"
Expand All @@ -137,7 +137,7 @@ exports[`Should render one button with a custom className and another one withou
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-th-large"
Expand All @@ -150,7 +150,7 @@ exports[`Should render one button with a custom className and another one withou
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-align-justify"
Expand All @@ -170,7 +170,7 @@ exports[`Should render two buttons 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-th-large"
Expand All @@ -183,7 +183,7 @@ exports[`Should render two buttons 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
<span
aria-label="su-align-justify"
Expand Down
Expand Up @@ -17,7 +17,7 @@ Array [
class="su-plus buttonIcon"
/>
<span
class="text"
class="buttonText"
>
sulu_admin.add
</span>
Expand Down Expand Up @@ -72,7 +72,7 @@ Array [
class="su-plus buttonIcon"
/>
<span
class="text"
class="buttonText"
>
sulu_admin.add
</span>
Expand Down
Expand Up @@ -29,7 +29,7 @@ Array [
type="button"
>
<span
class="text"
class="buttonText"
>
Confirm
</span>
Expand All @@ -39,7 +39,7 @@ Array [
type="button"
>
<span
class="text"
class="buttonText"
>
Cancel
</span>
Expand Down
Expand Up @@ -10,7 +10,7 @@ exports[`Render dropdown button 1`] = `
class="su-plus buttonIcon"
/>
<span
class="text"
class="buttonText"
>
Add
</span>
Expand Down
Expand Up @@ -9,7 +9,7 @@ exports[`Render a FileUploadButton 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
Upload something!
</span>
Expand Down Expand Up @@ -37,7 +37,7 @@ exports[`Render a FileUploadButton with other skin and icon 1`] = `
class="su-image buttonIcon"
/>
<span
class="text"
class="buttonText"
>
Upload something!
</span>
Expand All @@ -62,7 +62,7 @@ exports[`Render a disabled FileUploadButton 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
Upload something!
</span>
Expand Down
Expand Up @@ -9,7 +9,7 @@ exports[`The component should render 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
Action 1
</span>
Expand All @@ -19,7 +19,7 @@ exports[`The component should render 1`] = `
type="button"
>
<span
class="text"
class="buttonText"
>
Action 2
</span>
Expand Down
Expand Up @@ -40,7 +40,7 @@ Array [
type="button"
>
<span
class="text"
class="buttonText"
>
Action 1
</span>
Expand All @@ -50,7 +50,7 @@ Array [
type="button"
>
<span
class="text"
class="buttonText"
>
Action 2
</span>
Expand All @@ -61,7 +61,7 @@ Array [
type="button"
>
<span
class="text"
class="buttonText"
>
Apply
</span>
Expand Down

0 comments on commit 6df5665

Please sign in to comment.