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: make icons inside IconButtons flex to fit button container #154

Merged
merged 7 commits into from
Jan 11, 2021

Conversation

okry
Copy link
Contributor

@okry okry commented Jan 7, 2021

  • Icon SVGs now inherit height and width of wrapping div element.
  • IconButtons make SVG div wrappers expand/contract to fit the button container wrapping them
  • Had to remove padding from IconButtons since it was causing the interior icons to be offset by a significant amount

New hover indicator:
Screen Shot 2021-01-11 at 10 48 13 AM

New focus indicator:
Screen Shot 2021-01-11 at 10 47 45 AM

These indicators were taken from what we were using for the vanilla buttons and were tested to work with stretched buttons.

@okry okry requested review from scurker and schne324 January 7, 2021 16:55
@okry okry self-assigned this Jan 7, 2021
Copy link
Member

@scurker scurker left a comment

Choose a reason for hiding this comment

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

The outlines for the focus/hover states are now offset.

react cauldron icon in a hover state with an offset hover border

react cauldron icon in a focus state with an offset focus border

I think one of the things that might make this difficult, is the specificity of the hover states depend on a known height/width of the button.

@schne324
Copy link
Member

schne324 commented Jan 8, 2021

it looks like that focus ring issue already exists: https://cauldron.netlify.app/components/IconButton but I agree we should fix it

@scurker
Copy link
Member

scurker commented Jan 9, 2021

it looks like that focus ring issue already exists: https://cauldron.netlify.app/components/IconButton but I agree we should fix it

???

This is what I see on https://cauldron.netlify.app/components/IconButton:
image

There's a 1px spacing around the button icon, which doesn't exist in this PR.

For comparison:

image

@okry okry requested a review from scurker January 10, 2021 04:04
@okry
Copy link
Contributor Author

okry commented Jan 10, 2021

I've updated the indicators to reflect Aaron's designs by taking from what we were using for the other buttons. Updated icons are in the main description.

Copy link
Member

@scurker scurker left a comment

Choose a reason for hiding this comment

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

One more small minor change: Add pointer-events: none to the .IconButton:before pseudo element. We don't want the pseudo element to be triggering click events or activating when it's not supposed to. pointer-events: none should prevent both of these behaviors.

background-color: var(--icon-button-background-color);
color: var(--icon-button-icon-color);
margin: 2px;
padding: 0;
--button-hover-outline-color: var(--top-bar-text-color);
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a typo. I don't think --button-hover-outline-color is a valid CSS property.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wasn't a typo, it's a custom key that we were using for the hover outline. I essentially stole this methodology from the vanilla button css. Since it isn't repeated, I'll remove it for now.

Copy link
Member

Choose a reason for hiding this comment

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

CSS is crazy 🤯

.IconButton svg {
height: calc(var(--button-thin-height) - 4px);
width: calc(var(--button-thin-height) - 4px);
.IconButton div {
Copy link
Member

Choose a reason for hiding this comment

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

One more small thing I noticed, do you think this should be more specific? i.e. .IconButton .Icon?

div seems a bit too generic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@okry okry requested a review from scurker January 11, 2021 19:44
@okry okry merged commit 940300f into develop Jan 11, 2021
@okry okry deleted the fix/resizeable-icons branch January 11, 2021 20:42
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.

4 participants