Skip to content

Commit

Permalink
fix: refine chip margin logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzemp committed Feb 16, 2024
1 parent 583daca commit 9e6793d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions components/chip/src/chip.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Content } from './content.js'
import { Icon } from './icon.js'
import { Remove } from './remove.js'

const DEFAULT_INLINE_MARGIN = '4'

const Chip = ({
selected,
dense,
Expand Down Expand Up @@ -100,10 +102,12 @@ const Chip = ({
<style jsx>{`
span {
${marginBottom && `margin-bottom: ${marginBottom}px;`}
${marginInlineStart &&
`margin-inline-start: ${marginLeft ?? marginInlineStart}px;`}
${marginInlineEnd &&
`margin-inline-end: ${marginRight ?? marginInlineEnd}px;`}
margin-inline-start: ${marginInlineStart ??
marginLeft ??
DEFAULT_INLINE_MARGIN}px;
margin-inline-end: ${marginInlineEnd ??
marginRight ??
DEFAULT_INLINE_MARGIN}px;
${marginTop && `margin-top: ${marginTop}px`}
}
`}</style>
Expand All @@ -113,8 +117,6 @@ const Chip = ({
Chip.defaultProps = {
dataTest: 'dhis2-uicore-chip',
marginBottom: 4,
marginInlineStart: 4,
marginInlineEnd: 4,
marginTop: 4,
}

Expand Down

0 comments on commit 9e6793d

Please sign in to comment.