From f49fa4a8156c786f685354aa7b5d0cd3eb6edf90 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Tue, 7 Aug 2018 02:21:28 +0200 Subject: [PATCH] fix(chip): conforms to ion-icon fixes #15053 --- core/src/components.d.ts | 12 ++++++++++-- .../components/chip-button/chip-button.scss | 18 +++++++++--------- .../src/components/chip-button/chip-button.tsx | 3 ++- core/src/components/chip-icon/chip-icon.scss | 16 ++++++++-------- core/src/components/chip-icon/chip-icon.tsx | 8 +++++++- 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 9fe86618d5..da5ed3d3d4 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -468,7 +468,7 @@ declare global { /** * Set to `"clear"` for a transparent button style. */ - 'fill': string; + 'fill': 'clear' | 'solid'; /** * Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. */ @@ -492,6 +492,10 @@ declare global { * The icon to use. Possible values are the same as `"ion-icon"`. */ 'name': string; + /** + * The icon src to use. Possible values are the same as `"ion-icon"`. + */ + 'src': string; } interface IonChip { @@ -4058,7 +4062,7 @@ declare global { /** * Set to `"clear"` for a transparent button style. */ - 'fill'?: string; + 'fill'?: 'clear' | 'solid'; /** * Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. */ @@ -4082,6 +4086,10 @@ declare global { * The icon to use. Possible values are the same as `"ion-icon"`. */ 'name'?: string; + /** + * The icon src to use. Possible values are the same as `"ion-icon"`. + */ + 'src'?: string; } export interface IonChipAttributes extends HTMLAttributes { diff --git a/core/src/components/chip-button/chip-button.scss b/core/src/components/chip-button/chip-button.scss index a092d7144f..818fbe6781 100644 --- a/core/src/components/chip-button/chip-button.scss +++ b/core/src/components/chip-button/chip-button.scss @@ -4,24 +4,25 @@ // -------------------------------------------------- :host { - --background: var(--ion-color-base); - --color: var(--ion-color-contrast); - --size: #{$chip-button-size}; - --icon-size: 18px; --ion-color-base: #{ion-color(primary, base)}; --ion-color-contrast: #{ion-color(primary, contrast)}; + --size: #{$chip-button-size}; } :host(.chip-button-clear) { - --color: var(--ion-color-base); - --background: transparent; + --background: #{current-color(base)}; + + color: #{current-color(contrast)} } -::slotted(ion-icon) { - font-size: var(--icon-size); +:host(.chip-button-clear) { + --background: transparent; + + color: #{current-color(base)}; } .chip-button-native { + @include text-inherit(); @include border-radius($chip-button-border-radius); @include margin($chip-button-margin-top, $chip-button-margin-end, $chip-button-margin-bottom, $chip-button-margin-start); @@ -35,7 +36,6 @@ outline: none; background: var(--background); - color: var(--color); appearance: none; } diff --git a/core/src/components/chip-button/chip-button.tsx b/core/src/components/chip-button/chip-button.tsx index 03b148c5d9..d99932d03a 100644 --- a/core/src/components/chip-button/chip-button.tsx +++ b/core/src/components/chip-button/chip-button.tsx @@ -32,7 +32,7 @@ export class ChipButton { /** * Set to `"clear"` for a transparent button style. */ - @Prop() fill = 'default'; + @Prop() fill: 'clear' | 'solid' = 'solid'; /** * Contains a URL or a URL fragment that the hyperlink points to. @@ -54,6 +54,7 @@ export class ChipButton { return ( diff --git a/core/src/components/chip-icon/chip-icon.scss b/core/src/components/chip-icon/chip-icon.scss index d2f24b6587..048b173f57 100644 --- a/core/src/components/chip-icon/chip-icon.scss +++ b/core/src/components/chip-icon/chip-icon.scss @@ -1,9 +1,6 @@ @import "../../themes/ionic.globals"; :host { - --ion-color-base: #{ion-color(primary, base)}; - --ion-color-contrast: #{ion-color(primary, contrast)}; - @include border-radius(50%); display: inline-flex; @@ -14,11 +11,14 @@ width: var(--size, 32px); height: var(--size, 32px); - background-color: var(--ion-color-base); + + background: #{ion-color(primary, base)}; + color: #{ion-color(primary, contrast)}; + + font-size: 18px; } -ion-icon { - color: var(--ion-color-contrast); - - font-size: var(--icon-size, 18px); +:host(.ion-color) { + background: #{current-color(base)}; + color: #{current-color(contrast)}; } diff --git a/core/src/components/chip-icon/chip-icon.tsx b/core/src/components/chip-icon/chip-icon.tsx index 8e3f80cfe2..d2bfe676cf 100644 --- a/core/src/components/chip-icon/chip-icon.tsx +++ b/core/src/components/chip-icon/chip-icon.tsx @@ -28,6 +28,12 @@ export class ChipIcon { */ @Prop() name?: string; + /** + * The icon src to use. + * Possible values are the same as `"ion-icon"`. + */ + @Prop() src?: string; + hostData() { return { class: { @@ -37,6 +43,6 @@ export class ChipIcon { } render() { - return ; + return ; } }