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

refactor(tokens): move less variables to css props #2163

Merged
merged 7 commits into from
Oct 11, 2023

Conversation

saiponnada
Copy link
Contributor

@saiponnada saiponnada commented Sep 29, 2023

Fixes #1992, #2138

  • This PR contains CSS changes
  • This PR does not contain CSS changes

Description

Refactored following less variables to css variables

  • @font-size-*
  • @font-size-{variant}
  • @font-weight-*
  • @spacing-*

Left the rest(@_screen-size-, @_page-grid-, @marketsans-*) as the first two are constants and we don't want to allow overrides and the later due to restriction in css vars.

Notes

  • For font-size, we have flexibility with defining sizes(12, 14, 16...) and variants(like small, med, large..). It makes perfect sense using it in less. Assuming components use only variants, I personally feel there is no advantage of having that flexibility in css vars because its just a 1:1 mapping in tokens file. Besides that we will be sending all these tokens (more lines of code). While review, please state your preference to leave both as is or to simplify it. If we simplify it we need to identify the right variant tokens for combobox and select which are currently using --font-size-18

Checklist

  • I verify the build is in a non-broken state
  • I verify all changes are within scope of the linked issue
  • I regenerated all CSS files under dist folder
  • I tested the UI in all supported browsers
  • I did a visual regression check of the components impacted by doing a Percy build and approved the build
  • I tested the UI in dark mode and RTL mode
  • I added/updated/removed Storybook coverage as appropriate

@saiponnada saiponnada force-pushed the 1992-move-less-variable-to-css-props branch from c6acc22 to e1a6f9d Compare September 29, 2023 16:14
@saiponnada saiponnada self-assigned this Sep 29, 2023
@ianmcburnie
Copy link
Contributor

ianmcburnie commented Oct 2, 2023

One thing worthy of discussion is whether we want to continue with the token shorthand mixin that we were using for colors. or move away from that, e.g.

.color-token(filter-menu-item-foreground-color, color-foreground-primary);

FYI the first parameter here is intended as a component-level override (e.g. if we needed a version of the component on the page that needed to differ from the colour system). I also use this on MIND and Makeup to easily apply different non-ebay colors. There are probably different (and better?) ways to achieve the same goal though.

Here's example of the component-level API documented for switch: https://opensource.ebay.com/skin/#switch-variables

@saiponnada saiponnada marked this pull request as ready for review October 2, 2023 22:06
@saiponnada saiponnada requested a review from LuLaValva October 3, 2023 00:11
@saiponnada saiponnada force-pushed the 1992-move-less-variable-to-css-props branch from 769f73b to fbebc53 Compare October 4, 2023 16:34
@saiponnada
Copy link
Contributor Author

One thing worthy of discussion is whether we want to continue with the token shorthand mixin that we were using for colors. or move away from that

Team has discussed internally and decided to continue with the token mixin the way we are using for now. Need to have a separate discussion later on how we would like to define or expose API for component level by aligning with skin's long term vision.

Copy link
Contributor

@ArtBlue ArtBlue left a comment

Choose a reason for hiding this comment

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

Looks good. Assuming we resolve the conflict in the branch and things still look good, this is approved.

@saiponnada saiponnada force-pushed the 1992-move-less-variable-to-css-props branch from 5d2d346 to 72f0b41 Compare October 11, 2023 22:14
@saiponnada saiponnada merged commit f81fe1c into 16.8.0 Oct 11, 2023
@saiponnada saiponnada deleted the 1992-move-less-variable-to-css-props branch October 19, 2023 18:50
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.

3 participants