Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.
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
10 changes: 7 additions & 3 deletions packages/core/src/Chip/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,13 @@ exports[`Chips with icon 1`] = `
}

.c4 {
width: 24px;
color: rgb(122,122,122);
margin-left: -8px;
-webkit-flex: 0 0 min-content;
-ms-flex: 0 0 min-content;
flex: 0 0 min-content;
overflow: visible;
margin-left: -4px;
margin-right: 4px;
color: rgb(82,82,82);
}

.c7 {
Expand Down
17 changes: 9 additions & 8 deletions packages/core/src/Chip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import styled from 'styled-components'

import { CloseIcon } from 'practical-react-components-icons'

import { spacing, componentSize } from '../designparams'
import { spacing } from '../designparams'
import { ClickableIcon, Icon, IconType } from '../Icon'
import { Typography } from '../Typography'
import { BaseChip, BaseChipProps } from './BaseChip'

const ChipIcon = styled(Icon)`
width: ${componentSize.mini};
color: ${({ theme }) => theme.color.text05()};
margin-left: -${spacing.medium};
const ChipIcon = styled(Icon).attrs({ size: 'small' })`
flex: 0 0 min-content;
overflow: visible;
margin-left: -${spacing.small};
margin-right: ${spacing.small};
color: ${({ theme }) => theme.color.text03()};
`

const ChipRemoveIcon = styled(ClickableIcon).attrs({
Expand All @@ -22,6 +24,7 @@ const ChipRemoveIcon = styled(ClickableIcon).attrs({
icon: CloseIcon,
})`
flex: 0 0 min-content;
overflow: visible;
margin-left: ${spacing.small};
`

Expand All @@ -47,9 +50,7 @@ export const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
const component = useMemo(() => {
return (
<>
{!error && icon !== undefined ? (
<ChipIcon icon={icon} size="small" />
) : null}
{!error && icon !== undefined ? <ChipIcon icon={icon} /> : null}
<Typography variant="chip-tag-text">{text}</Typography>
{onRemove ? <ChipRemoveIcon onClick={onRemove} /> : null}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ exports[`Select Direction 1`] = `
-webkit-flex: 0 0 min-content;
-ms-flex: 0 0 min-content;
flex: 0 0 min-content;
overflow: visible;
margin-left: 4px;
}

Expand Down Expand Up @@ -603,6 +604,7 @@ exports[`Select Direction 2`] = `
-webkit-flex: 0 0 min-content;
-ms-flex: 0 0 min-content;
flex: 0 0 min-content;
overflow: visible;
margin-left: 4px;
}

Expand Down Expand Up @@ -1009,6 +1011,7 @@ exports[`Select Other 1`] = `
-webkit-flex: 0 0 min-content;
-ms-flex: 0 0 min-content;
flex: 0 0 min-content;
overflow: visible;
margin-left: 4px;
}

Expand Down Expand Up @@ -1422,6 +1425,7 @@ exports[`Select Other 2`] = `
-webkit-flex: 0 0 min-content;
-ms-flex: 0 0 min-content;
flex: 0 0 min-content;
overflow: visible;
margin-left: 4px;
}

Expand Down Expand Up @@ -1821,6 +1825,7 @@ exports[`Select Width 1`] = `
-webkit-flex: 0 0 min-content;
-ms-flex: 0 0 min-content;
flex: 0 0 min-content;
overflow: visible;
margin-left: 4px;
}

Expand Down Expand Up @@ -2220,6 +2225,7 @@ exports[`Select Width 2`] = `
-webkit-flex: 0 0 min-content;
-ms-flex: 0 0 min-content;
flex: 0 0 min-content;
overflow: visible;
margin-left: 4px;
}

Expand Down Expand Up @@ -2651,6 +2657,7 @@ exports[`Select Width 3`] = `
-webkit-flex: 0 0 min-content;
-ms-flex: 0 0 min-content;
flex: 0 0 min-content;
overflow: visible;
margin-left: 4px;
}

Expand Down