Skip to content

Commit

Permalink
fix: correct usage of dt/dd in description list
Browse files Browse the repository at this point in the history
  • Loading branch information
smeijer committed Mar 27, 2024
1 parent 47c31fc commit 8c6dd0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-emus-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@darkmagic/react': patch
---

fix dd/dt usage in description list
20 changes: 10 additions & 10 deletions packages/react/src/components/description-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ const StyledItem = styled('div', {
display: 'flex',
font: '$body-small',

'& dd': {
'& dt': {
truncate: true,
flex: 'none',
color: '$text-muted',
},

'& dt': {
'& dd': {
color: '$text-default',
},

variants: {
truncate: {
true: {
'& dt': {
'& dd': {
truncate: true,
},

Expand All @@ -40,22 +40,22 @@ const StyledItem = styled('div', {
true: {
flexDirection: 'column',
gap: '0',
'&& dd': {
'&& dt': {
width: 'unset',
},
},
false: {
flexDirection: 'row',
'&& dd': {
'&& dt': {
pr: '$4',
},
},
},

labelWidth: {
sm: { '& dd': { width: '$40' } },
md: { '& dd': { width: '$50' } },
lg: { '& dd': { width: '$60' } },
sm: { '& dt': { width: '$40' } },
md: { '& dt': { width: '$50' } },
lg: { '& dt': { width: '$60' } },
},
},

Expand Down Expand Up @@ -139,9 +139,9 @@ const Item = React.forwardRef<React.ElementRef<'div'>, ItemProps>(function Item(

return (
<StyledItem stacked={stacked} labelWidth={labelWidth} truncate={truncate} {...props} ref={ref}>
<dd>{label}</dd>
<dt>{label}</dt>
<StyledValue muted={!hasValue}>
<dt>{hasValue ? value : 'n/a'}</dt>
<dd>{hasValue ? value : 'n/a'}</dd>
{hasValue && showCopyButton && (
<StyledAddon>
<CopyButton variant="text" value={String(copyValue)} />
Expand Down

0 comments on commit 8c6dd0e

Please sign in to comment.