Skip to content

Commit

Permalink
Merge pull request #325 from appuniversum/feature/add-button-overflow
Browse files Browse the repository at this point in the history
Add wrap property to a button
  • Loading branch information
Dietr committed Sep 30, 2022
2 parents 04a7466 + dec35e1 commit 2fc6e2f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addon/components/au-button.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<button
class="au-c-button {{this.width}} {{this.size}} {{this.skin}} {{this.alert}} {{this.loading}} {{this.disabled}} {{if (and @icon @hideText) 'au-c-button--icon-only'}}" disabled={{@disabled}}
class="au-c-button {{this.width}} {{this.size}} {{this.skin}} {{this.alert}} {{this.loading}} {{this.disabled}} {{if (and @icon @hideText) 'au-c-button--icon-only'}} {{if @wrap 'au-c-button--wrap'}}" disabled={{@disabled}}
type="button"
...attributes
>
Expand Down
7 changes: 7 additions & 0 deletions app/styles/ember-appuniversum/_c-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@ $au-button-icon-only-width-large : $au-button-height-large !defa
}
}

// Wrap text inside a button
.au-c-button--wrap {
height: auto;
white-space: initial;
text-align: left;
}

// Block button
.au-c-button--block {
display: flex;
Expand Down
9 changes: 9 additions & 0 deletions stories/5-components/Buttons/AuButton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export default {
options: ['', 'block'],
description: 'Defines the width of a button',
},
wrap: {
control: 'boolean',
description: 'Wrap the text inside a button',
},
alert: {
control: 'boolean',
description: 'Adds an alert state to the button',
Expand Down Expand Up @@ -62,6 +66,7 @@ const Template = (args) => ({
@iconAlignment={{this.iconAlignment}}
@hideText={{this.hideText}}
@width={{this.width}}
@wrap={{this.wrap}}
@alert={{this.alert}}
@disabled={{this.disabled}}
@loading={{this.loading}}
Expand All @@ -81,6 +86,7 @@ Primary.args = {
iconAlignment: 'left',
hideText: false,
width: '',
wrap: '',
alert: false,
disabled: false,
loading: false,
Expand All @@ -95,6 +101,7 @@ Secondary.args = {
iconAlignment: 'left',
hideText: false,
width: '',
wrap: '',
alert: false,
disabled: false,
loading: false,
Expand All @@ -109,6 +116,7 @@ PrimaryLink.args = {
iconAlignment: 'left',
hideText: false,
width: '',
wrap: '',
alert: false,
disabled: false,
loading: false,
Expand All @@ -123,6 +131,7 @@ SecondaryLink.args = {
iconAlignment: 'left',
hideText: false,
width: '',
wrap: '',
alert: false,
disabled: false,
loading: false,
Expand Down

0 comments on commit 2fc6e2f

Please sign in to comment.