Skip to content

feat(theme): refactor themes#2454

Merged
nadiia merged 1 commit intomasterfrom
WPT-5198
Dec 13, 2019
Merged

feat(theme): refactor themes#2454
nadiia merged 1 commit intomasterfrom
WPT-5198

Conversation

@nadiia
Copy link
Contributor

@nadiia nadiia commented Dec 11, 2019

Description

The change is broken down in 3 separate commits:

  • Part#1 refactors theme
  • Part#2 add semantic color tokens
  • Part#3 applies newly added semantic color tokens in place of older to be deprecated semantic tokens

Scope

  • Patch: Bug Fix
  • Minor: New Feature
  • Major: Breaking Change

@vercel
Copy link

vercel bot commented Dec 11, 2019

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

🔍 Inspect: https://zeit.co/uber-ui-platform/baseweb/bxfxov9y5
🌍 Preview: https://baseweb-git-wpt-5198.uber-ui-platform.now.sh

@UberOpenSourceBot
Copy link
Contributor

Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #2455

borderBottomLeftRadius: borders.surfaceBorderRadius,
borderBottomRightRadius: borders.surfaceBorderRadius,
backgroundColor: colors.backgroundAlt,
backgroundColor: colors.backgroundSecondary,
Copy link
Contributor

@gergelyke gergelyke Dec 11, 2019

Choose a reason for hiding this comment

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

shouldn't it stay in the light theme?

@gergelyke
Copy link
Contributor

looks great!

@chasestarr
Copy link
Collaborator

many of the 'surface' backgrounds have changed from white to light grey in the vrts, was that intentional? Otherwise, the change lgtm

const foundation: FoundationSemanticColorTokensT = {
primaryA: colors.gray200,
primaryB: colors.gray900,
accent: colors.blue500,
Copy link
Contributor

Choose a reason for hiding this comment

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

if people have these already set as primitives in their current theme will they be overwritten by these keys with the same name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean if they create a custom theme and extend it with custom props? Then it depends on how they extend the current theme, should their custom props come last then it overrides what's in the default theme.

Copy link
Contributor

Choose a reason for hiding this comment

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

What would accent end up as on the final theme object if I did the following?

createTheme({
  // other primitives...
  accent: 'pink',
});

In createTheme we combine a bunch of colors:

const theme = {
    colors: {
      ...colorTokensWithOverrides, // user defined primitives
      ...getColorComponentTokens(colorTokensWithOverrides),
      ...getDeprecatedSemanticColors(colorTokensWithOverrides),
      ...semanticColors, // has `accent`, `positive`, etc.
    },
};

semanticColors has keys for accent, positive, etc. so wouldn't they override the primitives on the final theme object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. The accent, etc, will be overriden but not the other props that have value set from the theme primitives. I guess foundation semantic colors can be included in the theme building primitives and the sert of semantic values also built it taking overrides into account. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, maybe add primaryA and primaryB to ColorTokensT.

then we can use a getter like getSemanticColors(colorTokensWithOverrides) which will override the foundation values with the passed in primitives.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed it in here

@UberOpenSourceBot
Copy link
Contributor

Visual changes have been resolved. #2455 has been closed. If future commits on WPT-5198 trigger visual changes, a new snapshot branch will be created and a new PR will be opened.

@nadiia nadiia changed the title feat(theme): add semantic color tokens to the theme object feat(theme): refactor themes Dec 13, 2019
@nadiia
Copy link
Contributor Author

nadiia commented Dec 13, 2019

many of the 'surface' backgrounds have changed from white to light grey in the vrts, was that intentional? Otherwise, the change lgtm

You're right, I think the legacy backgroundAlt was the same as primary but in the new semantic values they are different. I changed it to use new backgroundPrimary in here. See the rendered docs here.

@nadiia nadiia merged commit 85c2f42 into master Dec 13, 2019
@uber-baseweb-probots uber-baseweb-probots bot deleted the WPT-5198 branch December 13, 2019 00:57
VladimirMilenko pushed a commit to VladimirMilenko/baseui that referenced this pull request Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants