diff --git a/src/components/card/card.ios.scss b/src/components/card/card.ios.scss index 1c3688002df..cecd166a484 100644 --- a/src/components/card/card.ios.scss +++ b/src/components/card/card.ios.scss @@ -102,14 +102,14 @@ $card-ios-header-color: #333 !default; border: 0; } -.card-ios ion-card-content { +.card-content-ios { padding: $card-ios-padding-top $card-ios-padding-right $card-ios-padding-bottom $card-ios-padding-left; font-size: $card-ios-font-size; line-height: 1.4; } -.card-ios ion-card-header { +.card-header-ios { padding: $card-ios-header-padding; font-size: $card-ios-header-font-size; @@ -117,8 +117,8 @@ $card-ios-header-color: #333 !default; color: $card-ios-header-color; } -.card-ios ion-card-header + ion-card-content, -.card-ios .item + ion-card-content { +.card-header-ios + .card-content-ios, +.card-ios .item + .card-content-ios { padding-top: 0; } @@ -127,7 +127,7 @@ $card-ios-header-color: #333 !default; font-size: 1.3rem; } -.card-ios ion-card-title { +.card-title-ios { display: block; margin: $card-ios-title-margin; @@ -172,3 +172,42 @@ $card-ios-header-color: #333 !default; .card-ios + ion-card { margin-top: 0; } + + +// Generate iOS Card Colors +// -------------------------------------------------- + +@each $color-name, $color-base, $color-contrast in get-colors($colors-ios) { + + .card-ios .text-ios-#{$color-name} { + color: $color-base; + } + + .card-ios-#{$color-name} { + color: $color-contrast; + background-color: $color-base; + + .card-header-ios, + .card-title-ios, + .card-content-ios, + p { + color: $color-contrast; + } + + @each $color-name, $color-base, $color-contrast in get-colors($colors-ios) { + .text-ios-#{$color-name}, + .card-header-ios-#{$color-name}, + .card-title-ios-#{$color-name}, + .card-content-ios-#{$color-name} { + color: $color-base; + } + } + } + + .card-header-ios-#{$color-name}, + .card-title-ios-#{$color-name}, + .card-content-ios-#{$color-name} { + color: $color-base; + } + +} diff --git a/src/components/card/card.md.scss b/src/components/card/card.md.scss index 5ab7c83f0c1..51c76712cff 100644 --- a/src/components/card/card.md.scss +++ b/src/components/card/card.md.scss @@ -107,22 +107,22 @@ $card-md-header-color: #222 !default; border: 0; } -.card-md ion-card-content { +.card-content-md { padding: $card-md-padding-top $card-md-padding-right $card-md-padding-bottom $card-md-padding-left; font-size: $card-md-font-size; line-height: $card-md-line-height; } -.card-md ion-card-header { +.card-header-md { padding: $card-md-header-padding; font-size: $card-md-header-font-size; color: $card-md-header-color; } -.card-md ion-card-header + ion-card-content, -.card-md .item + ion-card-content { +.card-header-md + .card-content-md, +.card-md .item + .card-content-md { padding-top: 0; } @@ -131,7 +131,7 @@ $card-md-header-color: #222 !default; font-size: 1.3rem; } -.card-md ion-card-title { +.card-title-md { display: block; margin: $card-md-title-margin; @@ -181,3 +181,48 @@ $card-md-header-color: #222 !default; .card-md + ion-card { margin-top: 0; } + + +// Generate Material Design Card Colors +// -------------------------------------------------- + +@each $color-name, $color-base, $color-contrast in get-colors($colors-md) { + + .card-md .text-md-#{$color-name} { + color: $color-base; + } + + .card-md-#{$color-name} { + color: $color-contrast; + background-color: $color-base; + + .card-header-md, + .card-title-md, + .card-content-md, + h1, + h2, + h3, + h4, + h5, + h6, + p { + color: $color-contrast; + } + + @each $color-name, $color-base, $color-contrast in get-colors($colors-md) { + .text-md-#{$color-name}, + .card-header-md-#{$color-name}, + .card-title-md-#{$color-name}, + .card-content-md-#{$color-name} { + color: $color-base; + } + } + } + + .card-header-md-#{$color-name}, + .card-title-md-#{$color-name}, + .card-content-md-#{$color-name} { + color: $color-base; + } + +} diff --git a/src/components/card/card.ts b/src/components/card/card.ts index 46d4920f84a..a2e63a18c09 100644 --- a/src/components/card/card.ts +++ b/src/components/card/card.ts @@ -43,7 +43,31 @@ export class Card extends Ion { @Directive({ selector: 'ion-card-content' }) -export class CardContent {} +export class CardContent extends Ion { + + /** + * @input {string} The predefined color to use. For example: `"primary"`, `"secondary"`, `"danger"`. + */ + @Input() + set color(val: string) { + this._setColor('card-content', val); + } + + /** + * @input {string} The mode to apply to this component. + */ + @Input() + set mode(val: string) { + this._setMode('card-content', val); + } + + constructor(config: Config, elementRef: ElementRef, renderer: Renderer) { + super(config, elementRef, renderer); + + this.mode = config.get('mode'); + } + +} /** @@ -52,7 +76,31 @@ export class CardContent {} @Directive({ selector: 'ion-card-header' }) -export class CardHeader {} +export class CardHeader extends Ion { + + /** + * @input {string} The predefined color to use. For example: `"primary"`, `"secondary"`, `"danger"`. + */ + @Input() + set color(val: string) { + this._setColor('card-header', val); + } + + /** + * @input {string} The mode to apply to this component. + */ + @Input() + set mode(val: string) { + this._setMode('card-header', val); + } + + constructor(config: Config, elementRef: ElementRef, renderer: Renderer) { + super(config, elementRef, renderer); + + this.mode = config.get('mode'); + } + +} /** * @private @@ -60,4 +108,28 @@ export class CardHeader {} @Directive({ selector: 'ion-card-title' }) -export class CardTitle {} +export class CardTitle extends Ion { + + /** + * @input {string} The predefined color to use. For example: `"primary"`, `"secondary"`, `"danger"`. + */ + @Input() + set color(val: string) { + this._setColor('card-title', val); + } + + /** + * @input {string} The mode to apply to this component. + */ + @Input() + set mode(val: string) { + this._setMode('card-title', val); + } + + constructor(config: Config, elementRef: ElementRef, renderer: Renderer) { + super(config, elementRef, renderer); + + this.mode = config.get('mode'); + } + +} diff --git a/src/components/card/card.wp.scss b/src/components/card/card.wp.scss index 9e4b1d25ed5..fc0f1bcd92b 100644 --- a/src/components/card/card.wp.scss +++ b/src/components/card/card.wp.scss @@ -108,22 +108,23 @@ $card-wp-header-color: #222 !default; border: 0; } -.card-wp ion-card-content { +.card-content-wp { padding: $card-wp-padding-top $card-wp-padding-right $card-wp-padding-bottom $card-wp-padding-left; font-size: $card-wp-font-size; line-height: $card-wp-line-height; } -.card-wp ion-card-header { +.card-header-wp { padding: $card-wp-header-padding; font-size: $card-wp-header-font-size; + color: $card-wp-header-color; } -.card-wp ion-card-header + ion-card-content, -.card-wp .item + ion-card-content { +.card-header-wp + .card-content-wp, +.card-wp .item + .card-content-wp { padding-top: 0; } @@ -132,7 +133,7 @@ $card-wp-header-color: #222 !default; font-size: 1.3rem; } -.card-wp ion-card-title { +.card-title-wp { display: block; margin: $card-wp-title-margin; @@ -182,3 +183,48 @@ $card-wp-header-color: #222 !default; .card-wp + ion-card { margin-top: 0; } + + +// Generate Windows Card Colors +// -------------------------------------------------- + +@each $color-name, $color-base, $color-contrast in get-colors($colors-wp) { + + .card-wp .text-wp-#{$color-name} { + color: $color-base; + } + + .card-wp-#{$color-name} { + color: $color-contrast; + background-color: $color-base; + + .card-header-wp, + .card-title-wp, + .card-content-wp, + h1, + h2, + h3, + h4, + h5, + h6, + p { + color: $color-contrast; + } + + @each $color-name, $color-base, $color-contrast in get-colors($colors-wp) { + .text-wp-#{$color-name}, + .card-header-wp-#{$color-name}, + .card-title-wp-#{$color-name}, + .card-content-wp-#{$color-name} { + color: $color-base; + } + } + } + + .card-header-wp-#{$color-name}, + .card-title-wp-#{$color-name}, + .card-content-wp-#{$color-name} { + color: $color-base; + } + +} diff --git a/src/components/card/test/colors/app-module.ts b/src/components/card/test/colors/app-module.ts new file mode 100644 index 00000000000..0bf1cc361bd --- /dev/null +++ b/src/components/card/test/colors/app-module.ts @@ -0,0 +1,30 @@ +import { Component, NgModule } from '@angular/core'; +import { IonicApp, IonicModule } from '../../../..'; + + +@Component({ + templateUrl: 'main.html' +}) +export class E2EPage {} + +@Component({ + template: '' +}) +export class E2EApp { + rootPage = E2EPage; +} + +@NgModule({ + declarations: [ + E2EApp, + E2EPage + ], + imports: [ + IonicModule.forRoot(E2EApp) + ], + bootstrap: [IonicApp], + entryComponents: [ + E2EPage + ] +}) +export class AppModule {} diff --git a/src/components/card/test/colors/e2e.ts b/src/components/card/test/colors/e2e.ts new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/src/components/card/test/colors/e2e.ts @@ -0,0 +1 @@ + diff --git a/src/components/card/test/colors/main.html b/src/components/card/test/colors/main.html new file mode 100644 index 00000000000..ec4c1d3913a --- /dev/null +++ b/src/components/card/test/colors/main.html @@ -0,0 +1,145 @@ + + + + Card Colors + + + + + + + + + + + Secondary Header + Primary Span in Header + + + + + Danger Title + + Some normal text in content. +

Normal h3 in content

+

+ Normal paragraph in default content. +

+

+ Secondary paragraph in default content. +

+
+ + + + + + + + + + + + +
+ + + + + Primary Header + + + + + Primary Title + + Some normal text in danger content. +

Normal h3 in content

+

+ Normal paragraph in danger content. +

+

+ Primary paragraph in danger content. +

+ +
+ + + + + + + + + + + + +
+ + + + + Primary Card + + + + + Danger Title + +

Heading

+

+ Normal paragraph in normal content. +

+

+ Secondary paragraph in normal content. +

+
+ + + + + + + + + + + +
+ + + + + Default Header + + + + + Default Title + +

Heading

+

+ Normal paragraph in normal content. +

+

+ Primary paragraph in normal content. +

+
+
+ +
diff --git a/src/components/item/item.ios.scss b/src/components/item/item.ios.scss index 23dc5e4296c..135e5a93bf4 100644 --- a/src/components/item/item.ios.scss +++ b/src/components/item/item.ios.scss @@ -236,6 +236,14 @@ ion-item-divider.item-ios { .item-ios-#{$color-name} { color: $color-contrast; background-color: $color-base; + + p { + color: $color-contrast; + } + + &.activated { + background-color: color-shade($color-base); + } } } diff --git a/src/components/item/item.md.scss b/src/components/item/item.md.scss index 2a00f90fbfb..9647d902a6c 100644 --- a/src/components/item/item.md.scss +++ b/src/components/item/item.md.scss @@ -239,6 +239,14 @@ ion-item-divider.item-md { .item-md-#{$color-name} { color: $color-contrast; background-color: $color-base; + + p { + color: $color-contrast; + } + + &.activated { + background-color: color-shade($color-base); + } } } diff --git a/src/components/item/item.wp.scss b/src/components/item/item.wp.scss index b14eb619d25..b87f3606870 100644 --- a/src/components/item/item.wp.scss +++ b/src/components/item/item.wp.scss @@ -236,6 +236,14 @@ ion-item-divider.item-wp { .item-wp-#{$color-name} { color: $color-contrast; background-color: $color-base; + + p { + color: $color-contrast; + } + + &.activated { + background-color: color-shade($color-base); + } } } diff --git a/src/components/item/test/colors/app-module.ts b/src/components/item/test/colors/app-module.ts new file mode 100644 index 00000000000..b27ac52c142 --- /dev/null +++ b/src/components/item/test/colors/app-module.ts @@ -0,0 +1,33 @@ +import { Component, NgModule } from '@angular/core'; +import { IonicApp, IonicModule } from '../../../..'; + + +@Component({ + templateUrl: 'main.html' +}) +export class E2EPage { + +} + +@Component({ + template: '' +}) +export class E2EApp { + rootPage = E2EPage; +} + +@NgModule({ + declarations: [ + E2EApp, + E2EPage + ], + imports: [ + IonicModule.forRoot(E2EApp) + ], + bootstrap: [IonicApp], + entryComponents: [ + E2EApp, + E2EPage + ] +}) +export class AppModule {} diff --git a/src/components/item/test/colors/e2e.ts b/src/components/item/test/colors/e2e.ts new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/src/components/item/test/colors/e2e.ts @@ -0,0 +1 @@ + diff --git a/src/components/item/test/colors/main.html b/src/components/item/test/colors/main.html new file mode 100644 index 00000000000..ce62863cda0 --- /dev/null +++ b/src/components/item/test/colors/main.html @@ -0,0 +1,81 @@ + + + + Item Colors + + + + + + + + +

Heading

+

Paragraph

+

Secondary paragraph

+
+ + +

Heading

+

Paragraph

+
+ + + a[ion-item] danger + + + + a[ion-item].activated danger + + + + + + + + +

Heading

+

Normal paragraph

+ +
+ + + left icon buttons +

Primary paragraph

+ + + + disabled left icon buttons +

Primary paragraph

+ + + + + right icon buttons + + + + + a ion-item disabled right icon/text button large +

Default paragraph

+
+ +