-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(button): add danger option (#46)
- Loading branch information
1 parent
a42a695
commit e38f563
Showing
13 changed files
with
206 additions
and
10 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
projects/ng-aquila/documentation/examples/button-danger/button-danger-example.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
:host { | ||
display: flex; | ||
flex-wrap: wrap; | ||
margin: 0 -8px; | ||
width: 100%; | ||
} | ||
|
||
button { | ||
margin: 0 8px 16px; | ||
} |
7 changes: 7 additions & 0 deletions
7
projects/ng-aquila/documentation/examples/button-danger/button-danger-example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<button nxButton="primary danger" type="button">Primary</button> | ||
<button nxButton="secondary danger" type="button">Secondary</button> | ||
<button nxButton="tertiary danger" type="button">Tertiary</button> | ||
|
||
<button nxButton="primary danger" type="button" disabled>Disabled</button> | ||
<button nxButton="secondary danger" type="button" disabled>Disabled</button> | ||
<button nxButton="tertiary danger" type="button" disabled>Disabled</button> |
11 changes: 11 additions & 0 deletions
11
projects/ng-aquila/documentation/examples/button-danger/button-danger-example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
/** | ||
* @title Danger Buttons Example | ||
*/ | ||
@Component({ | ||
templateUrl: './button-danger-example.html', | ||
styleUrls: ['./button-danger-example.css'] | ||
}) | ||
export class ButtonDangerExampleComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,35 @@ | ||
import { Component, ChangeDetectionStrategy } from '@angular/core'; | ||
import { Component, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; | ||
|
||
@Component({ | ||
// tslint:disable-next-line:component-selector | ||
selector: 'button[nxPlainButton]', | ||
templateUrl: './plain-button.component.html', | ||
styleUrls: ['plain-button.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
inputs: ['classNames:nxPlainButton'], | ||
host: { | ||
'[class.nx-plain-button--danger]': 'danger' | ||
} | ||
}) | ||
export class NxPlainButtonComponent { | ||
|
||
private _classNames: string; | ||
|
||
danger: boolean = false; | ||
|
||
public set classNames(value: string) { | ||
if (this._classNames === value) { | ||
return; | ||
} | ||
|
||
this._classNames = value; | ||
this.danger = /danger/.test(this._classNames); | ||
this._changeDetectorRef.markForCheck(); | ||
} | ||
|
||
public get classNames(): string { | ||
return this._classNames; | ||
} | ||
|
||
constructor(private _changeDetectorRef: ChangeDetectorRef) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters