diff --git a/addon/components/o-s-s/button.hbs b/addon/components/o-s-s/button.hbs
index 43a9b23e6..1cb5eb7a3 100644
--- a/addon/components/o-s-s/button.hbs
+++ b/addon/components/o-s-s/button.hbs
@@ -20,9 +20,15 @@
{{else if @iconUrl}}
{{/if}}
-
{{#if @label}}
{{@label}}
{{/if}}
+ {{#if @suffixIcon}}
+
+ {{/if}}
{{/if}}
\ No newline at end of file
diff --git a/addon/components/o-s-s/button.stories.js b/addon/components/o-s-s/button.stories.js
index 18e3374ee..3e05f6f23 100644
--- a/addon/components/o-s-s/button.stories.js
+++ b/addon/components/o-s-s/button.stories.js
@@ -97,6 +97,16 @@ export default {
type: 'text'
}
},
+ suffixIcon: {
+ description: 'Font Awesome class for an icon displayed after the label (e.g. fas fa-chevron-down)',
+ table: {
+ type: { summary: 'string' },
+ defaultValue: { summary: 'undefined' }
+ },
+ control: {
+ type: 'text'
+ }
+ },
square: {
description: 'Displays the button as a square. Useful for icon buttons.',
table: {
@@ -164,6 +174,7 @@ const defaultArgs = {
countDown: undefined,
loadingOptions: undefined,
iconUrl: undefined,
+ suffixIcon: undefined,
disabled: undefined
};
@@ -172,7 +183,8 @@ const Template = (args) => ({
+ @iconUrl={{this.iconUrl}} @suffixIcon={{this.suffixIcon}}
+ @loadingOptions={{this.loadingOptions}} disabled={{this.disabled}} />
`,
context: args
});
@@ -201,3 +213,11 @@ WithIconUrl.args = {
iconUrl: '/@upfluence/oss-components/assets/heart.svg'
}
};
+
+export const WithSuffixIcon = Template.bind({});
+WithSuffixIcon.args = {
+ ...defaultArgs,
+ ...{
+ suffixIcon: 'fas fa-chevron-down'
+ }
+};
diff --git a/addon/components/o-s-s/button.ts b/addon/components/o-s-s/button.ts
index 3a0329d88..6cd3fc2d9 100644
--- a/addon/components/o-s-s/button.ts
+++ b/addon/components/o-s-s/button.ts
@@ -77,6 +77,7 @@ export interface OSSButtonArgs {
loadingOptions?: LoadingOptions;
icon?: string;
iconUrl?: string;
+ suffixIcon?: string;
label?: string;
theme?: string;
square?: boolean;
diff --git a/tests/integration/components/o-s-s/button-test.ts b/tests/integration/components/o-s-s/button-test.ts
index 30189c303..025038bd8 100644
--- a/tests/integration/components/o-s-s/button-test.ts
+++ b/tests/integration/components/o-s-s/button-test.ts
@@ -50,6 +50,18 @@ module('Integration | Component | o-s-s/button', function (hooks) {
assert.dom('.upf-btn').hasText('Test');
});
+ test('it applies margin-left-px-18 to suffix icon when label is present', async function (assert) {
+ await render(hbs``);
+
+ assert.dom('.upf-btn i.fa-chevron-down').hasClass('margin-left-px-18');
+ });
+
+ test('it does not apply margin to suffix icon when label is absent', async function (assert) {
+ await render(hbs``);
+
+ assert.dom('.upf-btn i.fa-chevron-down').doesNotHaveClass('margin-left-px-18');
+ });
+
module('it renders with the correct skin', function () {
test('when using an unknown skin, it is set to default', async function (assert) {
await render(hbs``);
@@ -138,7 +150,7 @@ module('Integration | Component | o-s-s/button', function (hooks) {
assert.dom('.upf-btn i.fas').exists();
assert.dom('.upf-btn i.fas').hasClass('fa-circle-notch');
assert.dom('.upf-btn i.fas').hasClass('fa-spin');
- assert.dom('.upf-btn span.margin-left-px-6').doesNotExist();
+ assert.dom('.upf-btn span').doesNotExist();
});
test('when loading and the showLabel loading option is truthy, the label is displayed', async function (assert) {
@@ -148,8 +160,8 @@ module('Integration | Component | o-s-s/button', function (hooks) {
assert.dom('.upf-btn i.fas').exists();
assert.dom('.upf-btn i.fas').hasClass('fa-circle-notch');
assert.dom('.upf-btn i.fas').hasClass('fa-spin');
- assert.dom('.upf-btn span.margin-left-px-6').exists();
- assert.dom('.upf-btn span.margin-left-px-6').hasText('Test');
+ assert.dom('.upf-btn span').exists();
+ assert.dom('.upf-btn span').hasText('Test');
});
});