Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(components/primitive/typography): allow for use of className prop #2741

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

jordevo
Copy link
Contributor

@jordevo jordevo commented Jun 3, 2024

Primitive/Typography

πŸ” Show

TASK: N/A

Description, Motivation and Context

Currently, passing className to <PrimitiveTypography/> as a prop doesn't do anything, although it is documented as a legit prop.

This fixes the issue and allows for the extension of styles via classes when using this component.

Types of changes

  • πŸͺ² Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • πŸ’₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🧾 Documentation
  • πŸ“· Demo
  • πŸ§ͺ Test
  • 🧠 Refactor
  • πŸ’„ Styles
  • πŸ› οΈ Tool

Code example

Given this piece of React code:

<PrimitiveTypography as="h1" design="body-1" fontWeight="semi-bold" className="mt-TypographyBasic">
      lorem ipsum
</PrimitiveTypography>

The current output would be:

<h1 class="sui-PrimitiveTypography sui-PrimitiveTypography-design-body-1 sui-PrimitiveTypography-variant-default sui-PrimitiveTypography-fontSize-m sui-PrimitiveTypography-fontWeight-semi-bold sui-PrimitiveTypography-lineHeight-xl">lorem ipsum</h1>

The fix will make the output to be:

<h1 class="sui-PrimitiveTypography sui-PrimitiveTypography-design-body-1 sui-PrimitiveTypography-variant-default sui-PrimitiveTypography-fontSize-m sui-PrimitiveTypography-fontWeight-semi-bold sui-PrimitiveTypography-lineHeight-xl mt-TypographyBasic">lorem ipsum</h1>

Copy link

github-actions bot commented Jun 3, 2024

STATEMENTS BRANCHES FUNCTIONS LINES
≍ ≍ 0= ≍ 0= ≍ 0= ≍ 0=
% 75.96 64.37 65.95 77.73
ABS 3337 / 4393 2044 / 3175 653 / 990 3159 / 4064

@jordevo jordevo merged commit af00f9e into master Jun 4, 2024
7 checks passed
@jordevo jordevo deleted the fix-primitive-typography-classname-prop branch June 4, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants