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 style variable decimal import #3241

Merged
merged 13 commits into from
Jan 9, 2025

Conversation

akshay-gupta7
Copy link
Contributor

@akshay-gupta7 akshay-gupta7 commented Jan 7, 2025

Why does this PR exist?

Fixes #2706
Fixes #3213

What does this pull request do?

This PR addresses the issue when we import a style with text size or a Number variable with decimal values.

The import of a number like 33.6 is reflected as 33.599... in the corresponding token in the plugin

Also, addresses the number variables imported as NaNrem when the baseFontSize in ui Setting is blank.

Testing this change

  • Create a style in Figma with textSize Decimal type or a Number type variable with a Decimal value
  • Import in the plugin
  • See if the decimal value is imported to the closest 3 places after the decimal
  • For the second issue, go to settings and change baseFontSize to blank(thereby setting it to default 16px)
  • Import a Number variable with both options of 'Convert Number to dimensions' and 'use rem for dimension values' checked.
  • they should no longer be imported as NaNrem token values

Additional Notes (if any)

@akshay-gupta7 akshay-gupta7 requested a review from six7 January 7, 2025 15:58
@akshay-gupta7 akshay-gupta7 self-assigned this Jan 7, 2025
Copy link

changeset-bot bot commented Jan 7, 2025

🦋 Changeset detected

Latest commit: 2af11a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tokens-studio/figma-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Jan 7, 2025

⤵️ 📦 ✨ The artifact was successfully created! Want to test it? Download it here 👀 🎁

Copy link
Contributor

github-actions bot commented Jan 7, 2025

Commit SHA:94590a9c22e8a4bd3b4013b450926bfd27183028

Test coverage results 🧪

Code coverage diff between base branch:main and head branch: fix-style-variable-decimal-import 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 67.09 (0.01) 58.05 (-0.01) 63.86 (-0.01) 67.46 (0.01)
🔴 packages/tokens-studio-for-figma/src/plugin/pullVariables.ts 85.91 (0.62) 61.4 (-1.34) 100 (0) 85.07 (0.7)

Copy link
Contributor

github-actions bot commented Jan 7, 2025

Commit SHA:94590a9c22e8a4bd3b4013b450926bfd27183028
Current PR reduces the test coverage percentage by 1 for some tests

Copy link
Collaborator

@six7 six7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changeset and a test would be good

@akshay-gupta7 akshay-gupta7 requested a review from six7 January 9, 2025 17:30
Copy link
Collaborator

@six7 six7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@akshay-gupta7 akshay-gupta7 merged commit 35a0281 into main Jan 9, 2025
9 of 10 checks passed
@akshay-gupta7 akshay-gupta7 deleted the fix-style-variable-decimal-import branch January 9, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants