Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .loki/reference/chrome.laptop/Data_Display/Chip_Examples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 19 additions & 12 deletions packages/ui/src/chip/Chip.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Chip } from '@material-ui/core';
import { PropsLink } from '@superdispatch/ui-docs';
import { Inline } from '..';
import { Inline, Stack } from '..';

export default {
title: 'Data Display/Chip',
Expand All @@ -11,16 +11,23 @@ export default {
},
};

const colors = ['default', 'primary', 'secondary'] as const;

export const examples = () => (
<Inline>
<Chip label="Basic" />
<Chip label="Disabled" disabled={true} />
<Chip label="Clickable" clickable={true} />
<Chip
label="Deletable"
onDelete={() => {
alert('Delete!');
}}
/>
</Inline>
<Stack>
{colors.map((color) => (
<Inline key={color}>
<Chip label="Basic" color={color} />
<Chip label="Disabled" disabled={true} color={color} />
<Chip label="Clickable" clickable={true} color={color} />
<Chip
color={color}
label="Deletable"
onDelete={() => {
alert('Delete!');
}}
/>
</Inline>
))}
</Stack>
);
14 changes: 13 additions & 1 deletion packages/ui/src/chip/ChipOverrides.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SvgIcon } from '@material-ui/core';
import { ColorDynamic } from '../theme/Color';
import { Color, ColorDynamic } from '../theme/Color';
import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';

export function overrideChip(theme: SuperDispatchTheme): void {
Expand Down Expand Up @@ -65,6 +65,18 @@ export function overrideChip(theme: SuperDispatchTheme): void {
},
},

colorPrimary: {
'& $deleteIcon svg': {
color: Color.White,
},
},

colorSecondary: {
'& $deleteIcon svg': {
color: Color.White,
},
},

deleteIcon: {
width: undefined,
height: undefined,
Expand Down
8 changes: 8 additions & 0 deletions packages/ui/src/chip/__tests__/Chip.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,19 @@ it('checks component css', () => {
background-color: Color.Blue300;
}

.MuiChip-colorPrimary .MuiChip-deleteIcon svg {
color: Color.White;
}

.MuiChip-colorSecondary {
color: Color.White;
background-color: #f50057;
}

.MuiChip-colorSecondary .MuiChip-deleteIcon svg {
color: Color.White;
}

.MuiChip-clickable {
cursor: pointer;
user-select: none;
Expand Down