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: Adds new tokens to Incentives #49

Merged
merged 26 commits into from
May 24, 2022
Merged

Conversation

saranicoly
Copy link
Contributor

@saranicoly saranicoly commented May 18, 2022

What's the purpose of this pull request?

This PR intends to add new tokens to the Incentives component using the Theming Structure.
Corresponding PR in Nextjs store: vtex-sites/nextjs.store#56

How does it work?

This PR uses local variables to parameterize the Incentives properties, then connects these scoped tokens to the global ones.
It also adds a new variant to Incentives, which can be called like that:
< Incentives incentives={IncentivesMock} variant="vertical" />

New global tokens:

None.

New local tokens for Incentives:

Default properties:

Local token Default value/Global token linked
--fs-incentives-bkg-color var(--fs-color-primary-bkg-light)
--fs-incentives-gap var(--fs-spacing-4)
--fs-incentives-padding-top var(--fs-incentives-gap)
--fs-incentives-padding-bottom var(--fs-incentives-gap)
--fs-incentives-border-color var(--fs-border-color-light)
--fs-incentives-border-width var(--fs-border-width)

Nested Elements:

Title
Local token Default value/Global token linked
--fs-incentives-title-size var(--fs-text-size-1)
--fs-incentives-title-weight var(--fs-text-weight-bold)
--fs-incentives-title-line-height 1.42
--fs-incentives-title-color var(--fs-color-neutral-7)
Description
Local token Default value/Global token linked
--fs-incentives-description-size var(--fs-incentives-title-size)
--fs-incentives-description-line-height 1.14
--fs-incentives-description-color var(--fs-incentives-title-color)
Icon
Local token Default value/Global token linked
--fs-incentives-icon-color var(--fs-incentives-title-color)

How to test it?

The Incentives component should look just as it was before these changes. You may see it either on Gatsby store and on the Storybook.

Checklist

You may erase this after checking them all ;)

  • Added an entry in the CHANGELOG.md at the beginning of its due section. The latest version should comes first.

  • Added the PR number with the PR link at the entry in the CHANGELOG.md. E.g., New items in the pull_request_template.md (#12)

  • PR description

  • Updated the Storybook - if applicable.

  • Added a label according to the PR goal - Breaking change, Enhancement, Bug or Chore.

  • Added the component, hook, or pathname in-between backticks (``) - If applicable. E.g., ComponentName component.

  • Identified the function or parameter in the PR - If applicable. E.g., useWindowDimensions hook.

  • For documentation changes, ping @carolinamenezes or @Mariana-Caetano to review and update the changes.

@vercel
Copy link

vercel bot commented May 18, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
gatsby-store-storybook ✅ Ready (Inspect) Visit Preview May 23, 2022 at 10:22PM (UTC)

@vtex-sites
Copy link

vtex-sites bot commented May 18, 2022

Preview is ready

This pull request generated a Preview

👀   Preview: https://preview-49--gatsby.preview.vtex.app
🔬   Go deeper by inspecting the Build Logs
📝   based on commit 68266c0

@vtex-sites
Copy link

vtex-sites bot commented May 18, 2022

Lighthouse Reports

Here are the Lighthouse reports of this Pull Request

📝 Based on commit 68266c0

Lighthouse Report by page
📎   /
📎   /apple-magic-mouse-99988212/p
📎   /office

@renatamottam renatamottam changed the title feat: Adds new tokens to Link Feat: Adds new tokens to Incentives May 19, 2022
filipewl added a commit that referenced this pull request May 19, 2022
Try to improve the page LCP by boosting the priority for the main image.

By setting `fetchpriority` to `high` we can hint the browser to give a higher priority to our LCP images.

Use `psi-test` to compare before and after.

Page result - https://sfj-7de89f9--nextjs.preview.vtex.app/
| Metric | Mean | Standard deviation | Confidence Interval (95%) |
|--------|--------|--------|--------|
| Largest Contentful Paint (LCP) | 2221.49 | 152192.99 | [-64480.03, 68923.01] |
| Performance score | 0.839 | 0.000979 | [0.838571, 0.839429] |

Page result - https://sfj-f5d2958--nextjs.preview.vtex.app/
| Metric | Mean | Standard deviation | Confidence Interval (95%) |
|--------|--------|--------|--------|
| Largest Contentful Paint (LCP) | 1475.76 | 42521.48 | [-17160.10, 20111.61] |
| Performance score | 0.879 | 0.000619 | [0.878729, 0.879271] |

Page result - https://sfj-7de89f9--nextjs.preview.vtex.app/office
| Metric | Mean | Standard deviation | Confidence Interval (95%) |
|--------|--------|--------|--------|
| Largest Contentful Paint (LCP) | 1681.58 | 120980.33 | [-51340.39, 54703.55] |
| Performance score | 0.899 | 0.000625 | [0.899226, 0.899774] |

Page result - https://sfj-f5d2958--nextjs.preview.vtex.app/office
| Metric | Mean | Standard deviation | Confidence Interval (95%) |
|--------|--------|--------|--------|
| Largest Contentful Paint (LCP) | 1422.32 | 55090.06 | [-22721.96, 25566.61] |
| Performance score | 0.903 | 0.000169 | [0.902426, 0.902574] |

Page result - https://sfj-7de89f9--nextjs.preview.vtex.app/apple-magic-mouse-99988212/p
| Metric | Mean | Standard deviation | Confidence Interval (95%) |
|--------|--------|--------|--------|
| Largest Contentful Paint (LCP) | 2855.38 | 65371.98 | [-25795.15, 31505.92] |
| Performance score | 0.736 | 0.005824 | [0.733448, 0.738552] |

Page result - https://sfj-f5d2958--nextjs.preview.vtex.app/apple-magic-mouse-99988212/p
| Metric | Mean | Standard deviation | Confidence Interval (95%) |
|--------|--------|--------|--------|
| Largest Contentful Paint (LCP) | 2294.23 | 84993.06 | [-34955.62, 39544.08] |
| Performance score | 0.842 | 0.003156 | [0.840617, 0.843383] |

- [[web.dev] Optimizing resource loading with Priority Hints](https://web.dev/priority-hints/)
- [[web.dev] Optimize Largest Contentful Paint](https://web.dev/optimize-lcp/)
@saranicoly saranicoly changed the base branch from main to chore/fsss-306-add-optional-dependencies May 19, 2022 18:06
@saranicoly saranicoly changed the base branch from chore/fsss-306-add-optional-dependencies to main May 19, 2022 18:06
Copy link
Contributor

@filipewl filipewl left a comment

Choose a reason for hiding this comment

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

Nice job! 👏

Comment on lines 18 to 22
--fs-incentives-title-line-height : 1.42;

// Description
--fs-incentives-description-size : var(--fs-incentives-title-size);
--fs-incentives-description-line-height : 1.14;
Copy link
Contributor

Choose a reason for hiding this comment

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

@renatamottam and @hellofanny, are you planning to have tokens for the line-height? It would be nice to standardize some values in tokens so they don't feel arbitrary.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so. We have associate line-height for titles on Typography, not sure if this works for local values. But might be a good idea.

Copy link
Contributor

@hellofanny hellofanny left a comment

Choose a reason for hiding this comment

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

Looks great! 🤩 🤩 🤩 I noticed that Props section title was missing on the doc, so I've left it as a suggestion.

Co-authored-by: Fanny Chien <fannychienn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chore General tasks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants