Skip to content

Commit d5a12d3

Browse files
committed
fix: Chip colors
1 parent 5b37087 commit d5a12d3

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed
Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Chip } from '@material-ui/core';
22
import { PropsLink } from '@superdispatch/ui-docs';
3-
import { Inline } from '..';
3+
import { Inline, Stack } from '..';
44

55
export default {
66
title: 'Data Display/Chip',
@@ -11,16 +11,23 @@ export default {
1111
},
1212
};
1313

14+
const colors = ['default', 'primary', 'secondary'] as const;
15+
1416
export const examples = () => (
15-
<Inline>
16-
<Chip label="Basic" />
17-
<Chip label="Disabled" disabled={true} />
18-
<Chip label="Clickable" clickable={true} />
19-
<Chip
20-
label="Deletable"
21-
onDelete={() => {
22-
alert('Delete!');
23-
}}
24-
/>
25-
</Inline>
17+
<Stack>
18+
{colors.map((color) => (
19+
<Inline key={color}>
20+
<Chip label="Basic" color={color} />
21+
<Chip label="Disabled" disabled={true} color={color} />
22+
<Chip label="Clickable" clickable={true} color={color} />
23+
<Chip
24+
color={color}
25+
label="Deletable"
26+
onDelete={() => {
27+
alert('Delete!');
28+
}}
29+
/>
30+
</Inline>
31+
))}
32+
</Stack>
2633
);

packages/ui/src/chip/ChipOverrides.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SvgIcon } from '@material-ui/core';
2-
import { ColorDynamic } from '../theme/Color';
2+
import { Color, ColorDynamic } from '../theme/Color';
33
import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
44

55
export function overrideChip(theme: SuperDispatchTheme): void {
@@ -65,6 +65,18 @@ export function overrideChip(theme: SuperDispatchTheme): void {
6565
},
6666
},
6767

68+
colorPrimary: {
69+
'& $deleteIcon svg': {
70+
color: Color.White,
71+
},
72+
},
73+
74+
colorSecondary: {
75+
'& $deleteIcon svg': {
76+
color: Color.White,
77+
},
78+
},
79+
6880
deleteIcon: {
6981
width: undefined,
7082
height: undefined,

packages/ui/src/chip/__tests__/Chip.spec.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,19 @@ it('checks component css', () => {
8989
background-color: Color.Blue300;
9090
}
9191
92+
.MuiChip-colorPrimary .MuiChip-deleteIcon svg {
93+
color: Color.White;
94+
}
95+
9296
.MuiChip-colorSecondary {
9397
color: Color.White;
9498
background-color: #f50057;
9599
}
96100
101+
.MuiChip-colorSecondary .MuiChip-deleteIcon svg {
102+
color: Color.White;
103+
}
104+
97105
.MuiChip-clickable {
98106
cursor: pointer;
99107
user-select: none;

0 commit comments

Comments
 (0)