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

Feat/re introduce update styles #3174

Merged
merged 4 commits into from
Oct 16, 2024
Merged

Feat/re introduce update styles #3174

merged 4 commits into from
Oct 16, 2024

Conversation

six7
Copy link
Collaborator

@six7 six7 commented Oct 13, 2024

Why does this PR exist?

Closes #3165

Pre 2.0 plugin had functionality to update styles whenever tokens or themes change, instead of forcing users to go into the export to Figma dialog. This led to quite a bit of confusion, as theme swapping wasnt working for users anymore who kept their styles in the local document. The old version of the plugin basically updated local styles when you performed a theme swap, 2.0 required you to go to Export.

What does this pull request do?

This PR re-introduces this. The setting was still lingering around, so I went ahead and renamed this to shouldUpdateStyles, re-introduced the setting in the gear menu, and re-added the logic to call the updateStyles function whenever users update tokens or change themes (update.ts)

Before:

CleanShot.2024-10-13.at.10.08.20.mp4

After

CleanShot.2024-10-13.at.10.07.32.mp4

Testing this change

Open the .json file attached at the end, create styles the normal way, then enable the Update styles setting in the gear menu, and then later switch themes using the theme dropdown. Notice how now theme swapping appears to work (as under the hood its just updating the style values)

Additional notes

As of now, this setting is OFF by default. We should make sure we update our Docs and inform users about this functionality.

Copy link

changeset-bot bot commented Oct 13, 2024

🦋 Changeset detected

Latest commit: 238ee2c

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 Minor

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

@six7 six7 mentioned this pull request Oct 13, 2024
Copy link
Contributor

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

Copy link
Contributor

Commit SHA:03b7e804f17a3940d089c093c85a54661517d64d

Test coverage results 🧪

Code coverage diff between base branch:main and head branch: feat/re-introduce-update-styles 
Status File % Stmts % Branch % Funcs % Lines
🔴 total 67.89 (-0.02) 58.47 (0) 64.61 (-0.06) 68.28 (-0.01)
🔴 packages/tokens-studio-for-figma/src/app/components/SettingsDropdown.tsx 69.23 (-3.49) 100 (0) 20 (-5) 69.23 (-3.49)
🔴 packages/tokens-studio-for-figma/src/app/store/models/settings.tsx 76.08 (-3.46) 40 (0) 77.14 (-4.67) 76.08 (-3.46)
🔴 packages/tokens-studio-for-figma/src/plugin/asyncMessageHandlers/update.ts 93.33 (-6.67) 77.77 (-3.48) 100 (0) 93.33 (-6.67)

Copy link
Contributor

Commit SHA:03b7e804f17a3940d089c093c85a54661517d64d
Current PR reduces the test coverage percentage by 1 for some tests

@six7 six7 merged commit da1886d into main Oct 16, 2024
10 of 11 checks passed
@six7 six7 deleted the feat/re-introduce-update-styles branch October 16, 2024 07:35
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.

Theme-switching not Working with Prefix Styles with Theme Name
2 participants