Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

poc(Button): display svg icon path on button hover #364

Closed
wants to merge 2 commits into from

Conversation

miroslavstastny
Copy link
Member

This is just an experiment to learn how Button with Icon is supposed to be used in order to implement button which contains an icon which is 'filled' on hover.

Requirements (@200%):

  normal :hover
light  image  image
dark image image
hc image  image

Proposed implementation concerns

  • Proposed implementation works fine for light and dark theme, I do not know how to implement that for HC theme.
  • It uses static class name (ui-icon__filled)

),
styles: {
svg: () => ({
color: 'inherit',
Copy link
Member Author

Choose a reason for hiding this comment

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

This works better with button hover, see circular button example with this icon vs call icon

export default {
icon: ({ classes }) => (
<svg viewBox="0 0 32 32" role="presentation" className={classes.svg}>
<g className="icons-default-fill">
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if we need this class for anything.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need this for icons in Stardust. I am going to be importing all the icons without this class


color?: string
backgroundColor?: string
borderColor?: string
horizontalSpace: string
margin: string
secondaryColor: string
filled?: boolean
Copy link
Contributor

@kuzhelov kuzhelov Oct 16, 2018

Choose a reason for hiding this comment

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

probably, we should think about making this part of the Icon's interface

@@ -9,6 +9,11 @@ const Usage = () => (
description="A button used in cards is a &quot;tinted&quot; version of a default button."
examplePath="components/Button/Usage/ButtonUsageExample"
/>
<ComponentExample
title="Toolbar button"
description="Icon paths change on hover"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: just for the sake of consistency, there should be dot at the end ;)

Copy link
Contributor

@kuzhelov kuzhelov left a comment

Choose a reason for hiding this comment

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

do like the approach - the only problem, probably, an apparent one, is that there are quite a lot of indirections involved here. At the same time, worth to notice that this PR reduces, arguably, their amount to the best possible one. Also, it seems that there are some ways to further encapsulate idea of this approach under more convenient generic API exposed by utility methods

@miroslavstastny
Copy link
Member Author

@codepretty - could you please review this to verify it is in line with your changes/plans on SVG icons?

@codecov
Copy link

codecov bot commented Nov 1, 2018

Codecov Report

Merging #364 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #364   +/-   ##
=======================================
  Coverage   91.77%   91.77%           
=======================================
  Files          41       41           
  Lines        1325     1325           
  Branches      169      169           
=======================================
  Hits         1216     1216           
  Misses        105      105           
  Partials        4        4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bb41a4...f3afeed. Read the comment docs.

iconOnly
text
styles={{
'&:hover .ui-icon__filled': {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't you also need to hide the unfilled version?

@@ -122,6 +122,9 @@ const iconStyles: ComponentSlotStylesInput<IconProps, any> = {
path: getSvgStyle('path'),

secondaryPath: getSvgStyle('secondaryPath'),

unfilled: getSvgStyle('unfilled'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am implementing this in my PR where we won't need to have these styles defined in each SVG. I also named them filled & outline. Do you think filled & unfilled works better?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think filled & outline are fine, unfilled was used in legacy client.

@miroslavstastny
Copy link
Member Author

Closing this for now, will create a new PR once #478 is merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed 🚀 ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants