Skip to content

Commit

Permalink
Fix Body's font weight (#2765)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer authored Nov 4, 2024
1 parent 6e67e01 commit 6fdeea0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-radios-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sumup-oss/circuit-ui': patch
---

Fixed the Body's font weight when rendered as a `strong` element.
7 changes: 3 additions & 4 deletions packages/circuit-ui/components/Body/Body.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

/* Weights */

.base.regular {
.regular {
font-weight: var(--cui-font-weight-regular);
}

.base.semibold {
.semibold {
font-weight: var(--cui-font-weight-semibold);
}

.base.bold {
.bold {
font-weight: var(--cui-font-weight-bold);
}

Expand Down Expand Up @@ -88,7 +88,6 @@
/* Variants */

.highlight,
strong.base,
.base strong {
font-weight: var(--cui-font-weight-semibold);
}
Expand Down
9 changes: 8 additions & 1 deletion packages/circuit-ui/components/Body/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ function getHTMLElement(variant?: Variant): AsPropType {
return 'p';
}

function getDefaultWeight(as?: AsPropType) {
if (as === 'strong') {
return 'semibold';
}
return 'regular';
}

export const deprecatedSizeMap: Record<string, string> = {
'one': 'm',
'two': 's',
Expand All @@ -104,7 +111,7 @@ export const Body = forwardRef<HTMLParagraphElement, BodyProps>(
className,
as,
size: legacySize = 'm',
weight = 'regular',
weight = getDefaultWeight(as),
decoration,
color = 'normal',
variant,
Expand Down

0 comments on commit 6fdeea0

Please sign in to comment.