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

Implement Core Typography #98589

Closed
wants to merge 1 commit into from
Closed

Conversation

yashwin
Copy link
Contributor

@yashwin yashwin commented Jan 20, 2025

Proposed Changes

This PR creates heading and body text mixins on Calypso that match with Core Typography.

Edit

We are using the core mixins and variables here

Why are these changes being made?

To align the user experience more closely with Core, we are implementing Core typography within Calypso. This would allow A4A and Dotcom to adopt consistent typography moving forward.

Testing Instructions

  • Open the A4A live link
  • Go to Marketplace: Products(marketplace/products) > We have updated one text from this page to use the newly created mixin as this is behind a feature flag and we have designed this page as per Core Typography. Verify everything looks good.
Screenshot 2025-01-20 at 4 35 49 PM

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@yashwin yashwin self-assigned this Jan 20, 2025
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@yashwin yashwin requested review from keoshi, madebynoam and a team January 20, 2025 11:21
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 20, 2025
@matticbot
Copy link
Contributor

matticbot commented Jan 20, 2025

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/implement-core-typography on your sandbox.

@madebynoam
Copy link

Thanks, @yashwin! Lgtm!

Copy link
Contributor

@keoshi keoshi left a comment

Choose a reason for hiding this comment

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

LGTM!

@yashwin yashwin requested review from a team, matt-west, jasmussen and crisbusquets January 21, 2025 02:28
@ciampo
Copy link
Contributor

ciampo commented Jan 21, 2025

Creating a local copy of something that is only half-implemented in core can very easily lead to inconsistencies that will diverge more and more as time goes.

Reading pfunGA-4Ch-p2 , I'm not sure I see a consensus from the folks who worked on the original core specs to go ahead with this approach (@jameskoster @jasmussen ). Let's make sure we're aligned before committing to this approach (also cc @Automattic/team-calypso )

@yashwin yashwin force-pushed the add/implement-core-typography branch from e04d432 to bb96cd5 Compare January 21, 2025 07:48
@yashwin
Copy link
Contributor Author

yashwin commented Jan 21, 2025

Creating a local copy of something that is only half-implemented in core can very easily lead to inconsistencies that will diverge more and more as time goes.

Reading pfunGA-4Ch-p2 , I'm not sure I see a consensus from the folks who worked on the original core specs to go ahead with this approach (@jameskoster @jasmussen ). Let's make sure we're aligned before committing to this approach (also cc @Automattic/team-calypso )

Thank you for raising this point! You can see the thread: p1737113968596349-slack-C0896RP2P28. I have also asked for their review on this PR 🙂

@yashwin yashwin requested a review from a team January 21, 2025 08:06
@ciampo
Copy link
Contributor

ciampo commented Jan 21, 2025

Thank you for sharing the link — this conversation happening across p2, slack and GH was quite hard to follow and I had missed it initially.

I also think we should make sure we have a strategy for how, in the future, we're going to converge and unify the local copy being added today, with the code sitting upstream.

Are we even going to be able to import variables/mixins from Core? Are we going to get tokens via theming? Are we going to apply the typography via the Text and Heading components from @worpress/components package once they implement the new typography rules?

Knowing the future strategy will also inform what's the best way to implement a local copy.

@jasmussen
Copy link
Member

Marco shares some good concerns, which I also share and have voiced on the thread. However ultimately I'll defer to Jay on what's the best practice.

@jameskoster
Copy link
Contributor

For me the important thing in the short term is to utilise a single set of tokens for typographical appearance, and avoid anything custom or hard-coded. The scss vars/mixins recently added to the system seem like the best candidate for us to rally around, with a view to holistically expanding/refining later as required.

In terms of how we do it, Marco will know much better than me.

Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

I also agree with @ciampo's concerns.

Duplicating core typography styles can lead to additional maintenance work and potential inconsistencies as the codebases diverge.

Have we considered a way to actually reuse them instead of duplicating them?

Also, we need to think about a plan on potential changes that might be necessary in the future. Specifically, we might need to push changes upstream at some point, so it only makes sense to stay as close to core as possible and reuse everything.

@yashwin
Copy link
Contributor Author

yashwin commented Jan 21, 2025

Thanks for the review, @tyxla!

Have we considered a way to actually reuse them instead of duplicating them?

Could you please elaborate on what you mean by "reuse" here?

FWIW, we are using the core mixins and variables here

Edit:

We are exploring if there is a way to import directly from wp-base-styles

@tyxla
Copy link
Member

tyxla commented Jan 22, 2025

Could you please elaborate on what you mean by "reuse" here?
We are exploring if there is a way to import directly from wp-base-styles

Yes, something like that is what I'd prefer. Even if they're the same as core, redeclaring them essentially duplicates them and incurs additional maintenance costs.

@yashwin
Copy link
Contributor Author

yashwin commented Jan 22, 2025

Thanks everyone for the feedback!

We can reuse the mixins from Core. Read more: pfunGA-4Ch-p2#comment-7828 So, I'm closing this PR as we will create a new PR.

@yashwin yashwin closed this Jan 22, 2025
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 22, 2025
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.

8 participants