Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(badge): Eva theme #1407

Merged
merged 13 commits into from
Apr 22, 2019
Prev Previous commit
Next Next commit
refactor(badge): move status class to host element
BREAKING CHANGE:

Badge status class now set on host element
  • Loading branch information
yggg committed Apr 20, 2019
commit 1eb461d41c3e9286a8afd08b0086f39b5b0c56d9
29 changes: 27 additions & 2 deletions src/framework/theme/components/badge/badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

import { Component, Input } from '@angular/core';
import { Component, HostBinding, Input } from '@angular/core';

import { NbLayoutDirectionService } from '../../services/direction.service';
import { NbComponentStatus } from '../component-status';
Expand Down Expand Up @@ -66,7 +66,7 @@ export type NbBadgePosition = NbBadgePhysicalPosition | NbBadgeLogicalPosition;
selector: 'nb-badge',
styleUrls: ['./badge.component.scss'],
template: `
<span class="nb-badge {{positionClass}} status-{{status}}">{{text}}</span>
<span class="nb-badge {{positionClass}}">{{text}}</span>
`,
})
export class NbBadgeComponent {
Expand Down Expand Up @@ -102,5 +102,30 @@ export class NbBadgeComponent {
.replace(/\bend\b/, endValue);
}

@HostBinding('class.status-primary')
get primary(): boolean {
return this.status === 'primary';
}

@HostBinding('class.status-success')
get success(): boolean {
return this.status === 'success';
}

@HostBinding('class.status-info')
get info(): boolean {
return this.status === 'info';
}

@HostBinding('class.status-warning')
get warning(): boolean {
return this.status === 'warning';
}

@HostBinding('class.status-danger')
get danger(): boolean {
return this.status === 'danger';
}

constructor(private layoutDirectionService: NbLayoutDirectionService) {}
}