Skip to content

Commit

Permalink
Merge pull request #222 from Achintha444/main
Browse files Browse the repository at this point in the history
feat(react): update the design of the `Chip` component.
  • Loading branch information
Achintha444 authored Jul 8, 2024
2 parents 1196a33 + da5032f commit 92e950f
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 12 deletions.
75 changes: 71 additions & 4 deletions packages/react/src/components/Chip/chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,90 @@
*/

.oxygen-chip {
border-radius: var(--oxygen-customComponents-Chip-properties-border-radius);
border: var(--oxygen-customComponents-Chip-properties-border);
text-transform: var(--oxygen-customComponents-Chip-properties-text-transform);
font-weight: var(--oxygen-customComponents-Chip-properties-font-weight);
line-height: var(--oxygen-customComponents-Chip-properties-line-height);

&-premium {
background: var(--oxygen-customComponents-Chip-properties-premium-background);
color: var(--oxygen-customComponents-Chip-properties-premium-text-color);
border: var(--oxygen-customComponents-Chip-properties-border);
border-radius: var(--oxygen-customComponents-Chip-properties-border-radius);
border-color: var(--oxygen-customComponents-Chip-properties-premium-border-color);
font-weight: var(--oxygen-customComponents-Chip-properties-font-weight);
line-height: var(--oxygen-customComponents-Chip-properties-line-height);

.MuiChip-icon {
fill: var(--oxygen-customComponents-Chip-properties-premium-border-color);
}

.MuiChip-label {
background-clip: var(--oxygen-customComponents-Chip-properties-background-clip);
background-image: var(--oxygen-customComponents-Chip-properties-premium-text-color);
background-blend-mode: var(--oxygen-customComponents-Chip-properties-premium-text-background-blend-mode);
color: var(--oxygen-customComponents-Chip-properties-text-fill-color);
text-transform: var(--oxygen-customComponents-Chip-properties-text-transform);
}
}

&-new {
background: var(--oxygen-customComponents-Chip-properties-new-background);
color: var(--oxygen-customComponents-Chip-properties-new-text-color);
border-radius: var(--oxygen-customComponents-Chip-properties-border-radius);
border: var(--oxygen-customComponents-Chip-properties-border);
border-color: var(--oxygen-customComponents-Chip-properties-new-border-color);
font-weight: var(--oxygen-customComponents-Chip-properties-font-weight);
line-height: var(--oxygen-customComponents-Chip-properties-line-height);

.MuiChip-icon {
fill: var(--oxygen-customComponents-Chip-properties-new-border-color);
}

.MuiChip-label {
background-clip: var(--oxygen-customComponents-Chip-properties-background-clip);
color: var(--oxygen-customComponents-Chip-properties-text-fill-color);
background-image: var(--oxygen-customComponents-Chip-properties-new-text-color);
text-transform: var(--oxygen-customComponents-Chip-properties-text-transform);
}
}

&-beta {
background: var(--oxygen-customComponents-Chip-properties-beta-background);
color: var(--oxygen-customComponents-Chip-properties-beta-text-color);
border-radius: var(--oxygen-customComponents-Chip-properties-border-radius);
border: var(--oxygen-customComponents-Chip-properties-border);
border-color: var(--oxygen-customComponents-Chip-properties-beta-border-color);
font-weight: var(--oxygen-customComponents-Chip-properties-font-weight);
line-height: var(--oxygen-customComponents-Chip-properties-line-height);

.MuiChip-icon {
fill: var(--oxygen-customComponents-Chip-properties-beta-border-color);
}

.MuiChip-label {
background-clip: var(--oxygen-customComponents-Chip-properties-background-clip);
color: var(--oxygen-customComponents-Chip-properties-text-fill-color);
background-image: var(--oxygen-customComponents-Chip-properties-beta-text-color);
text-transform: var(--oxygen-customComponents-Chip-properties-text-transform);
}
}

&-experimental {
background: var(--oxygen-customComponents-Chip-properties-experimental-background);
color: var(--oxygen-customComponents-Chip-properties-experimental-text-color);
border-radius: var(--oxygen-customComponents-Chip-properties-border-radius);
border: var(--oxygen-customComponents-Chip-properties-border);
border-color: var(--oxygen-customComponents-Chip-properties-experimental-border-color);
font-weight: var(--oxygen-customComponents-Chip-properties-font-weight);
line-height: var(--oxygen-customComponents-Chip-properties-line-height);

.MuiChip-icon {
fill: var(--oxygen-customComponents-Chip-properties-experimental-border-color);
}

.MuiChip-label {
background-clip: var(--oxygen-customComponents-Chip-properties-background-clip);
color: var(--oxygen-customComponents-Chip-properties-text-fill-color);
background-image: var(--oxygen-customComponents-Chip-properties-experimental-text-color);
text-transform: var(--oxygen-customComponents-Chip-properties-text-transform);
}
}
}
14 changes: 14 additions & 0 deletions packages/react/src/models/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,30 @@ interface CustomTheme {
};
Chip?: {
properties?: {
'background-clip'?: string;
'beta-background'?: string;
'beta-border-color'?: string;
'beta-text-color'?: string;
border?: string;
'border-radius'?: string;
'default-background'?: string;
'default-border-color'?: string;
'default-text-color'?: string;
'experimental-background'?: string;
'experimental-border-color'?: string;
'experimental-text-color'?: string;
'font-weight'?: string;
'line-height'?: string;
'moz-text-fill-color'?: string;
'new-background'?: string;
'new-border-color'?: string;
'new-text-color'?: string;
'premium-background'?: string;
'premium-border-color'?: string;
'premium-text-background-blend-mode'?: string;
'premium-text-color'?: string;
'text-fill-color'?: string;
'text-transform'?: string;
};
};
Header?: {
Expand Down
33 changes: 25 additions & 8 deletions packages/react/src/theme/default-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,33 @@ export const generateDefaultThemeOptions = (baseTheme: Theme): RecursivePartial<
Chip: {
// TODO: Move these to color palette.
properties: {
'beta-background': '#2ab1da',
'beta-text-color': 'var(--oxygen-palette-primary-contrastText)',
'background-clip': 'text',
'beta-background':
'linear-gradient(132deg, rgba(143, 197, 246, 0.04) 28.46%, rgba(72, 141, 180, 0.04) 119.09%);',
'beta-border-color': 'rgba(143, 197, 246, 0.9)',
'beta-text-color': 'linear-gradient(132deg, rgba(143, 197, 246) 28.46%, rgba(72, 141, 180) 119.09%);',
border: '1px solid',
'border-radius': '8px',
'default-background': 'var(--oxygen-palette-primary-main)',
'default-text-color': 'var(--oxygen-palette-primary-contrastText)',
'experimental-background': '#a73fe3',
'experimental-text-color': 'var(--oxygen-palette-primary-contrastText)',
'new-background': '#3fb81f',
'new-text-color': 'var(--oxygen-palette-primary-contrastText)',
'premium-background': '#d2a600',
'premium-text-color': 'var(--oxygen-palette-primary-contrastText)',
'experimental-background':
'linear-gradient(132deg, rgba(233, 95, 255, 0.04) 28.46%, rgba(140, 57, 153, 0.04) 119.09%)',
'experimental-border-color': 'rgba(233, 95, 255, 0.9)',
'experimental-text-color': 'linear-gradient(132deg, rgba(233, 95, 255) 0%, rgba(140, 57, 153) 100%)',
'font-weight': '700',
'line-height': '20px',
'moz-text-fill-color': 'transparent',
'new-background': 'linear-gradient(132deg, rgba(117, 237, 161, 0.04) 28.46%, rgba(52, 146, 86, 0.04) 119.09%)',
'new-border-color': 'rgba(117, 237, 161, 0.9)',
'new-text-color': 'linear-gradient(132deg, rgba(117, 237, 161) 28.46%, rgba(52, 146, 86) 119.09%)',
'premium-background':
'linear-gradient(88deg, rgba(236, 81, 97, 0.04) -3.25%, rgba(248, 118, 67, 0.04) 102.62%)',
'premium-border-color': 'rgba(255, 169, 106)',
'premium-text-background-blend-mode': 'darken',
'premium-text-color':
'radial-gradient(238.39% 44.19% at 96.59% 31.25%, rgba(255, 255, 255, 0.30) 0%, rgba(255, 255, 255, 0.00) 100%), radial-gradient(182.56% 55.34% at 5.68% 100%, rgba(246, 251, 34, 0.51) 0%, rgba(255, 158, 69, 0.00) 100%), radial-gradient(137.51% 118.3% at 32.95% 0%, rgba(255, 137, 137, 0.92) 21.25%, rgba(255, 169, 106, 0.57) 88.62%), radial-gradient(178.09% 220.16% at 94.89% -132.81%, #FF7A00 67.59%, rgba(255, 199, 0, 0.38) 100%)',
'text-fill-color': 'transparent',
'text-transform': 'uppercase',
},
},
Header: {
Expand Down

0 comments on commit 92e950f

Please sign in to comment.