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

Include all shadow variables in theme object #1309

Merged
merged 3 commits into from
Jun 16, 2021
Merged

Conversation

colebemis
Copy link
Contributor

Problem

We were not including all shadow variables from Primer Primitives in the Primer React theme object.

Background

In Primer Primitives, colors and shadows are stored in one object. In Primer React, we need to store colors and shadows in two separate objects. We split up the Primer Primitives object using this partitionColors function:

function partitionColors(colors) {
  return {
    colors: filterObject(colors, value => isColorValue(value)),
    shadows: filterObject(colors, value => isShadowValue(value))
  }
}

I figured out that we were omitting some shadow variables in the theme object because isShadowValue() was incorrectly return false when passed some valid shadow values.

Solution

This PR updates the isShadowValue() function to correctly handle more shadow values and adds tests to avoid future regressions.

cc @dmarcey @mattcosta7

@changeset-bot
Copy link

changeset-bot bot commented Jun 15, 2021

🦋 Changeset detected

Latest commit: def1444

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/components Patch

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

@vercel
Copy link

vercel bot commented Jun 15, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/EKvkDKshThnWfiLG7tb1v7N1367m
✅ Preview: https://primer-components-git-update-shadow-parsing-primer.vercel.app

@vercel vercel bot temporarily deployed to Preview June 15, 2021 18:25 Inactive
Copy link
Member

@dgreif dgreif left a comment

Choose a reason for hiding this comment

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

Thanks for adding tests!!

@vercel vercel bot temporarily deployed to Preview June 15, 2021 22:08 Inactive
@dgreif dgreif merged commit dc17a49 into main Jun 16, 2021
@dgreif dgreif deleted the update-shadow-parsing branch June 16, 2021 15:18
@github-actions github-actions bot mentioned this pull request Jun 16, 2021
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.

None yet

2 participants