Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 8 additions & 1 deletion addon/components/utils/account-banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface UtilsAccountBannerArgs {
readonly?: boolean;
disabled?: boolean;
skin?: SkinType;
plain?: boolean;
alert?: Alert;

canSelectItem?: boolean;
Expand Down Expand Up @@ -52,14 +53,20 @@ export default class extends Component<UtilsAccountBannerArgs> {
return this.args.selected ? 'account-banner--selected' : '';
}

get plainClass(): string {
return this.args.plain ? 'account-banner--plain' : '';
}

get borderColorClass(): string {
if (this.isErrored) return 'account-banner--error';
if (this.args.skin) return `account-banner--${this.args.skin}`;
return '';
}

get modifierClasses(): string {
return [this.disabledClass, this.selectedClass, this.borderColorClass].filter((mc) => !isBlank(mc)).join(' ');
return [this.disabledClass, this.selectedClass, this.borderColorClass, this.plainClass]
.filter((mc) => !isBlank(mc))
.join(' ');
}

get canSelectItem(): boolean {
Expand Down
16 changes: 16 additions & 0 deletions app/styles/components/utils/account-banner.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
}
}

&--plain {
.background-color-white;
}

&--selected {
border-color: var(--color-primary-500);
background-color: var(--color-primary-50);
Expand Down Expand Up @@ -60,4 +64,16 @@
}

transition: ease-in-out 0.25s;

.upf-alert {
overflow: visible;

.indicator {
border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
}

.main-container {
border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
}
}
}
8 changes: 7 additions & 1 deletion tests/integration/components/utils/account-banner-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ module('Integration | Component | utils/account-banner', function (hooks) {
assert.dom('.account-banner').hasClass('account-banner--selected');
assert.dom('.account-banner').hasClass('account-banner--disabled');
});

test('@plain applies plain class', async function (assert) {
await render(hbs`<Utils::AccountBanner @plain={{true}} />`);

assert.dom('.account-banner').hasClass('account-banner--plain');
});
});

module('icon / image', function () {
Expand Down Expand Up @@ -124,7 +130,7 @@ module('Integration | Component | utils/account-banner', function (hooks) {
test('it renders @subtitle', async function (assert) {
await render(hbs`<Utils::AccountBanner @subtitle="subtitle" />`);

assert.dom('[data-control-name="account-banner-selected-item-label"]').containsText('subtitle');
assert.dom('[data-control-name="account-banner-selected-item-label"]').hasText('subtitle');
});

test('it renders custom-subtitle block', async function (assert) {
Expand Down
Loading