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: create new theme #723

Merged
merged 15 commits into from
Jan 26, 2024
Merged

🚀 feat: create new theme #723

merged 15 commits into from
Jan 26, 2024

Conversation

tcK1
Copy link
Member

@tcK1 tcK1 commented Jan 19, 2024

JIRA Issue

Description 📄

This PR creates and exports a new theme, based on new tokens. This new theme can be used on applications by passing the theme prop to the ThemeProvider.

Platforms 📲

  • Web
  • Mobile

Type of change 🔍

  • 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)
  • This change requires a documentation update

How Has This Been Tested? 🧪

Find the places on the doc/labnative that are using the ThemeProvider and add the new theme to it. E.g.:

import { ThemeProvider, v3theme } from '@gympass/yoga';

 <ThemeProvider theme={v3theme}>
  {/* ... */}
 </ThemeProvider>
  • Unit Test
  • Snapshot Test

Checklist: 🔍

  • My code follows the contribution guide of this project Contributing Guide
  • Layout matches design prototype: FIGMA
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Comment on lines +69 to +83
hopeNew,
relaxNew,
neon,
sand,
peaceNew,
upliftNew,
deepPurpleNew,
successNew,
neutralNew,
staminaNew,
deepNew,
mediumNew,
lightNew,
lightest,
clearNew,
Copy link
Contributor

Choose a reason for hiding this comment

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

potential issue: isn't this going to require changes in all the components that use the colours directly?

  • They'd have to know whether to pick the new and the old. A few components already do it via a variant prop IIRC.
  • When we inevitably remove the old one, won't we need to remove the new suffix, creating another potential breaking change?

(there's another discussion here... should the components read the colours directly?)

Copy link
Member Author

Choose a reason for hiding this comment

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

We are solving this with the theme: https://github.com/gympass/yoga/pull/723/files#diff-7c44dab781eac6c7c111934646f7760210c5556222abaace43c08a350788f217R7-R18

Components access the values from the theme and not the tokens directly (although they are the same in this case). As you said, using the tokens directly is probably another discussion and I agree we shouldn't be doing this, but having it inside the theme helped us keep everything using the expected colors 😄.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah! I was thinking of just having it done on the theme itself but not exposing it via the tokens. Do you think it's worth it to "hide" these new tokens on packages/yoga/src/Theme/theme/theme.js#theme function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe in the future, as it will be a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant only the new suffixed ones 😅

packages/tokens/src/global/fonts.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,58 @@
import createTheme from '../helpers/themeGenerator';

export const v3theme = createTheme(tokens => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: I think we shouldn't call it v3 as the yoga package is already on 7 :P might be confusing for who is importing it. What about something like refreshedTheme or newTheme?

@tcK1 tcK1 requested a review from goncalo-matos January 22, 2024 16:38
@tcK1 tcK1 merged commit b891245 into master Jan 26, 2024
3 checks passed
@tcK1 tcK1 deleted the yoga3-theme branch January 26, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants