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(icons): make icons themeable (breaking change) #726

Merged
merged 14 commits into from
May 3, 2019
Merged

Conversation

montezume
Copy link
Contributor

@montezume montezume commented May 2, 2019

Summary

As we discussed on slack, in order to make the icons themeable, we need to do something about the theme prop. When you use a styled component in emotion, it injects its theme prop, which we were overwriting since we had an identically named prop.

💣 BREAKING CHANGES 💣

  • Renames the prop theme to color. Renames it's possible values from being our old colour decisions (white, green, etc) to our new colour decisions (surface, primary, etc).

Why do we need themeable icons?

Components that use icons, like for example, the TimeInput need this to maintain consistency.

Why are you spelling colour wrong?

😭

This will be merged into the 10.0.0 branch. The PR is set to master now so that Percy runs.

Copy link
Member

@emmenko emmenko left a comment

Choose a reason for hiding this comment

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

LGTM! 💯

PS: there are some weird inconsistencies in percy...or did we break something?

@@ -39,7 +39,7 @@ The `hintIcon` also accepts a custom `theme` while defaulting to `orange` in the
onInfoButtonClick={() => {}} />}
hint={<FormattedMessage {...messages.hint} />}
- hintIcon={<WarningIcon />}
+ hintIcon={<WarningIcon theme="green" />}
+ hintIcon={<WarningIcon color="green" />}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
+ hintIcon={<WarningIcon color="green" />}
+ hintIcon={<WarningIcon color="primary" />}

| Props | Type | Required | Values | Default | Description |
| ------- | -------- | :------: | ------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------ |
| `size` | `string` | | 'small', 'medium', 'big', 'scale' | 'big' | Specifies the icon size (if `scale` is selected, the dimensions will scale according with the parents) |
| `color` | `string` | | 'solid', 'neutral60', 'info', 'primary40', 'warning', 'error' | 'solid' | Specifies the icon color |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| `color` | `string` | | 'solid', 'neutral60', 'info', 'primary40', 'warning', 'error' | 'solid' | Specifies the icon color |
| `color` | `string` | | 'solid', 'neutral60', 'info', 'primary', 'primary40', 'warning', 'error' | 'solid' | Specifies the icon color |

case 'warning':
return overwrittenVars.colorWarning;
case 'error':
return overwrittenVars.colorError;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if this could be more of a convention approach instead of switching?

Copy link
Contributor

Choose a reason for hiding this comment

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

Still valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can you check the latest version?

Copy link
Contributor

@tdeekens tdeekens left a comment

Choose a reason for hiding this comment

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

Wondering if we should have this to a base branch of release/x.x.x if we want more accumulate more breaking changes.

if (isDisabled) return 'grey';
if (tone === 'urgent') return 'white';
return 'black';
const getArrowColor = ({ tone, isDisabled }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good rename!

@montezume
Copy link
Contributor Author

I think the Percy diff it's a combination of breaking things and of the icon VRTs (7 I think) have different labels so therefore have a diff. But yeah, must be some broken things. I'll fix up the broken things tomorrow 😄

@montezume
Copy link
Contributor Author

@tdeekens I think that a v10 branch is a really good idea 👍

@montezume montezume changed the base branch from master to 10.0.0 May 3, 2019 07:50
@montezume
Copy link
Contributor Author

Ah Percy doesn't run if I have it aimed against a different branch. I guess that makes sense.

@montezume montezume changed the base branch from 10.0.0 to master May 3, 2019 08:15
...theme,
};

const iconColor = overwrittenVars[`color${capitalize(color)}`];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this more like what you were thinking @tdeekens ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah. Thanks!

@montezume montezume requested a review from aminbenselim May 3, 2019 08:42
Copy link

@aminbenselim aminbenselim left a comment

Choose a reason for hiding this comment

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

it's funny because the old values were more color than the new ones 😅

}
return 'white';
return 'surface';
}

// if button is disabled, icon should be grey

Choose a reason for hiding this comment

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

should we update the comments too ?

@montezume montezume changed the base branch from master to 10.0.0 May 3, 2019 09:17
@montezume
Copy link
Contributor Author

Okay, I'll merge this into 10.0.0 then. Thanks 👍

@montezume montezume merged commit cc8653e into 10.0.0 May 3, 2019
@montezume montezume deleted the ml-icon-theme branch May 3, 2019 09:26
montezume added a commit that referenced this pull request May 6, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request May 6, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request May 7, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request May 7, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request May 8, 2019
* feat(icons): make icons themeable (breaking change)
jonnybel pushed a commit that referenced this pull request May 8, 2019
* feat(icons): make icons themeable (breaking change)
jonnybel pushed a commit that referenced this pull request May 21, 2019
* feat(icons): make icons themeable (breaking change)
jonnybel pushed a commit that referenced this pull request Jun 4, 2019
* feat(icons): make icons themeable (breaking change)
jonnybel pushed a commit that referenced this pull request Jun 7, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request Jun 20, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request Jun 21, 2019
* feat(icons): make icons themeable (breaking change)
@montezume montezume mentioned this pull request Jun 21, 2019
montezume added a commit that referenced this pull request Jun 24, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request Jun 25, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request Jul 4, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request Jul 8, 2019
* feat(icons): make icons themeable (breaking change)
montezume added a commit that referenced this pull request Jul 8, 2019
* feat(icons): make icons themeable (breaking change)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants