mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(button): strong decorator
This commit is contained in:
committed by
Adam Bradley
parent
4219eae1f7
commit
fa0579fe46
@@ -312,3 +312,11 @@ $button-ios-round-border-radius: $button-round-border-radius
|
||||
@include ios-button-outline($color-name, $color-base, $color-contrast);
|
||||
@include ios-button-clear($color-name, $color-base, $color-contrast);
|
||||
}
|
||||
|
||||
|
||||
// iOS strong Button
|
||||
// --------------------------------------------------
|
||||
|
||||
.button-strong-ios {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -424,3 +424,11 @@ $button-md-round-border-radius: $button-round-border-radius !def
|
||||
@include md-button-outline($color-name, $color-base, $color-contrast);
|
||||
@include md-button-clear($color-name, $color-base, $color-contrast);
|
||||
}
|
||||
|
||||
|
||||
// MD strong Button
|
||||
// --------------------------------------------------
|
||||
|
||||
.button-strong-md {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -138,6 +138,9 @@ export class Button extends Ion {
|
||||
/** @private */
|
||||
_display: string; // block/full
|
||||
|
||||
/** @private */
|
||||
_decorator: string; // strong
|
||||
|
||||
/** @private */
|
||||
_init: boolean;
|
||||
|
||||
@@ -213,6 +216,14 @@ export class Button extends Ion {
|
||||
this._attr('_display', 'full', val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @input {boolean} A button that has strong importance, ie. it represents an important action.
|
||||
*/
|
||||
@Input()
|
||||
set strong(val: boolean) {
|
||||
this._attr('_decorator', 'strong', val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @input {string} The mode to apply to this component.
|
||||
*/
|
||||
@@ -301,6 +312,7 @@ export class Button extends Ion {
|
||||
this._setClass(this._shape, assignCssClass); // button-round
|
||||
this._setClass(this._display, assignCssClass); // button-full
|
||||
this._setClass(this._size, assignCssClass); // button-small
|
||||
this._setClass(this._decorator, assignCssClass); // button-strong
|
||||
this._updateColor(this._color, assignCssClass); // button-secondary, bar-button-secondary
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,3 +315,11 @@ $button-wp-round-border-radius: $button-round-border-r
|
||||
@include wp-button-outline($color-name, $color-base, $color-contrast);
|
||||
@include wp-button-clear($color-name, $color-base, $color-contrast);
|
||||
}
|
||||
|
||||
|
||||
// WP strong Button
|
||||
// --------------------------------------------------
|
||||
|
||||
.button-strong-wp {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
32
src/components/button/test/decorator/app-module.ts
Normal file
32
src/components/button/test/decorator/app-module.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { IonicApp, IonicModule } from '../../../..';
|
||||
|
||||
|
||||
@Component({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
export class E2EPage {
|
||||
strong = false;
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: '<ion-nav [root]="rootPage"></ion-nav>'
|
||||
})
|
||||
export class E2EApp {
|
||||
rootPage = E2EPage;
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
E2EApp,
|
||||
E2EPage
|
||||
],
|
||||
imports: [
|
||||
IonicModule.forRoot(E2EApp)
|
||||
],
|
||||
bootstrap: [IonicApp],
|
||||
entryComponents: [
|
||||
E2EPage
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
||||
4
src/components/button/test/decorator/e2e.ts
Normal file
4
src/components/button/test/decorator/e2e.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
it('should click edit button', function() {
|
||||
element(by.css('.e2eButtonEdit')).click();
|
||||
});
|
||||
57
src/components/button/test/decorator/main.html
Normal file
57
src/components/button/test/decorator/main.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-toolbar>
|
||||
<ion-title>Outline Buttons</ion-title>
|
||||
<ion-buttons end>
|
||||
<button ion-button [strong]="strong" (click)="strong = !strong" class="e2eButtonEdit">
|
||||
{{strong ? 'Done' : 'Edit' }}
|
||||
</button>
|
||||
</ion-buttons>
|
||||
</ion-toolbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding style="text-align:center" class="outer-content">
|
||||
|
||||
<p>
|
||||
<button ion-button [strong]="strong" small>Default (small)</button>
|
||||
<button ion-button strong small>Default (small)</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button ion-button outline [strong]="strong" color="secondary">Outline</button>
|
||||
<button ion-button outline strong color="secondary">Outline</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button ion-button block [strong]="strong" color="danger" large>Block (large)</button>
|
||||
<button ion-button block strong color="danger" large>Block (large)</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button ion-button full [strong]="strong" color="dark">Full</button>
|
||||
<button ion-button full strong color="dark">Default</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button ion-button raised [strong]="strong" color="light">Raised</button>
|
||||
<button ion-button raised strong color="light">Raised</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button ion-button round [strong]="strong">Round</button>
|
||||
<button ion-button round strong>Round</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button ion-button clear [strong]="strong">Clear</button>
|
||||
<button ion-button clear strong>Clear</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button ion-button clear [strong]="strong">Default</button>
|
||||
<button ion-button clear strong>Default</button>
|
||||
</p>
|
||||
|
||||
</ion-content>
|
||||
Reference in New Issue
Block a user