Skip to content

Commit

Permalink
fix(components): fix color issues in button and chip (#2141)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsahitya authored Apr 9, 2024
1 parent 2b7c6dd commit 74f0106
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 0 deletions.
13 changes: 13 additions & 0 deletions apps/knapsack/data/knapsack.pattern.button.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
"type": "string",
"description": "Icon to display, and aria-label value when label is not defined"
},
"color": {
"type": "string",
"enum": [
"primary",
"secondary",
"emphasis",
"neutral",
"caution",
"negative",
"positive"
],
"description": "Applies the button color"
},
"raised": {
"description": "Creates a contained button that is elevated above the surface",
"type": "boolean"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ export interface Button {
* Icon to display, and aria-label value when label is not defined
*/
icon?: string;
/**
* Applies the button color
*/
color?:
| 'primary'
| 'secondary'
| 'emphasis'
| 'neutral'
| 'caution'
| 'negative'
| 'positive';
/**
* Creates a contained button that is elevated above the surface
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@
"type": "string",
"description": "Icon to display, and aria-label value when label is not defined"
},
"color": {
"type": "string",
"enum": [
"primary",
"secondary",
"emphasis",
"neutral",
"caution",
"negative",
"positive"
],
"description": "Applies the button color"
},
"raised": {
"description": "Creates a contained button that is elevated above the surface",
"type": "boolean"
Expand Down
27 changes: 27 additions & 0 deletions apps/knapsack/dist/meta/knapsack.html-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,33 @@
"name": "icon",
"description": "Icon to display, and aria-label value when label is not defined"
},
{
"name": "color",
"values": [
{
"name": "primary"
},
{
"name": "secondary"
},
{
"name": "emphasis"
},
{
"name": "neutral"
},
{
"name": "caution"
},
{
"name": "negative"
},
{
"name": "positive"
}
],
"description": "Applies the button color"
},
{
"name": "raised",
"description": "boolean Creates a contained button that is elevated above the surface"
Expand Down
1 change: 1 addition & 0 deletions libs/components/src/chips/chip-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class ChipBase extends LitElement {
'mdc-evolution-chip--selectable': this.filter,
'mdc-evolution-chip--with-avatar': this.avatar,
secondary: this.state === 'secondary',
positive: this.state === 'positive',
negative: this.state === 'negative',
caution: this.state === 'caution',
};
Expand Down
4 changes: 4 additions & 0 deletions libs/components/src/chips/chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
background-color: var(--mdc-theme-surface-primary);
}

&.positive {
background-color: var(--cv-theme-surface-positive);
}

&.negative {
background-color: var(--mdc-theme-surface-negative);
}
Expand Down
5 changes: 5 additions & 0 deletions libs/components/src/chips/chips.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ Caution.args = {
state: 'caution',
};

export const Positive = Template.bind({});
Positive.args = {
state: 'positive',
};

export const Negative = Template.bind({});
Negative.args = {
state: 'negative',
Expand Down

0 comments on commit 74f0106

Please sign in to comment.