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

fix(icon-button): hover state fix, and remove HOC #871

Merged
merged 7 commits into from
Jun 18, 2019

Conversation

montezume
Copy link
Contributor

@montezume montezume commented Jun 18, 2019

Summary

Fixes a bug with hovering IconButtons with "green" theme. Also, refactors the component to remove the usage of the HOC.

Before

before-green

After

after-green

@@ -169,6 +169,7 @@ const getThemeStyles = theme => {
switch (theme) {
case 'green':
return css`
&:hover,
&:active {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was missing hover, so you never saw green on hover

@montezume montezume force-pushed the ml-try-icon-inline-flex branch from 3b4e2bf to f4536ac Compare June 18, 2019 12:07
@@ -73,21 +68,16 @@ export const IconButton = props => {
css={css`
width: 100%;
height: 100%;
display: flex;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

my hope is this fixes @adnasa's issue

<IconButton
icon={<InformationIcon />}
label="A label text"
onClick={() => {}}
isToggleButton={true}
isToggled={true}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these tests make more sense now because the output will actually be blue...

@montezume montezume self-assigned this Jun 18, 2019
@montezume montezume added the 🐛 Type: Bug Something isn't working label Jun 18, 2019
@montezume montezume requested review from emmenko and jonnybel June 18, 2019 12:11
@@ -42,10 +40,6 @@ export const IconButton = props => {
const isActive = props.isToggleButton && props.isToggled;
return (
<div
Copy link
Contributor

@jonnybel jonnybel Jun 18, 2019

Choose a reason for hiding this comment

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

Is it also possible to get rid of this div and apply the styles to the AccessibleButton component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

giving it a shot now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay removed it, and VRTs passed 🤷‍♂

Copy link
Contributor

@jonnybel jonnybel Jun 18, 2019

Choose a reason for hiding this comment

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

Nice!
I always found it weird that we had an AccessibleButton component which already deals with the mouse events, but then wrapped within a dull div which then reimplemented those mouse events with the HoC... I guess there must have been some other reason before, but something that got refactored? 🤔

It makes sense that it can be removed given how useless it seemed at the moment 🤷‍♂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you want to approve then 🧐

@@ -169,7 +169,7 @@ const getThemeStyles = theme => {
switch (theme) {
case 'green':
return css`
&:active {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was the bug

"bundled": 866961,
"minified": 596248,
"gzipped": 121235,
"bundled": 879277,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the problem is we don't run "yarn build" enough so this is always outdated.

Copy link
Contributor

@jonnybel jonnybel left a comment

Choose a reason for hiding this comment

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

Extra points for that refactor 😌

@montezume montezume removed the request for review from emmenko June 18, 2019 12:58
@montezume montezume merged commit 823a31f into master Jun 18, 2019
@montezume montezume deleted the ml-try-icon-inline-flex branch June 18, 2019 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants