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: pictogram rendering bugs #4081

Merged
merged 3 commits into from
Sep 25, 2019

Conversation

vpicone
Copy link
Contributor

@vpicone vpicone commented Sep 25, 2019

Closes #4080

white boxes: We were both moving attributes to group elements while trying to take them away, this prevented us from adequately stripping/collapsing wrapper groups with more than one layer.

black boxes: we were only removing rectangles that matched the icon sizes: ['16', '20', '24', '32']. Since we're not gonna need bespoke pictogram sizes, extending this again shouldn't be necessary.

Preview link: https://carbon-pictograms.now.sh/guidelines/iconography/pictograms

@vpicone vpicone requested a review from a team as a code owner September 25, 2019 00:00
@ghost ghost requested review from abbeyhrt and alisonjoseph September 25, 2019 00:00
Copy link
Contributor

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Left some questions above!

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

@joshblack you're too quick, I answered both in the PR comment

@netlify
Copy link

netlify bot commented Sep 25, 2019

Deploy preview for the-carbon-components ready!

Built with commit f750530

https://deploy-preview-4081--the-carbon-components.netlify.com

@netlify
Copy link

netlify bot commented Sep 25, 2019

Deploy preview for carbon-elements ready!

Built with commit f750530

https://deploy-preview-4081--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Sep 25, 2019

Deploy preview for carbon-components-react ready!

Built with commit f750530

https://deploy-preview-4081--carbon-components-react.netlify.com

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

@joshblack Also added a Pictogram component to the react build helpers so we don't get the Icon display name in dev tools. The components directory of icon-build helpers only had Icon, but needed some adjustments in builder.js to account for other components.

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

There’s also 13 pictograms without categories. They’re under “undefined” at the preview link.

Copy link
Contributor

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Ignore this lol

@joshblack
Copy link
Contributor

@vpicone my preference would be to treat all of them as Icon components under the hood if we could, is there any way that we could consolidate things under <Icon>? The only worry being that we're duplicating logic between them so naturally would have to update both any time an update came in, with this being the case might make sense for them to just be the same component.

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

@joshblack ah I was thrown off by the components directory. My thought was they’re going to have a different height/width behavior as well as a different display name would warrant them having distinct components.

@joshblack
Copy link
Contributor

What would be the difference for width/height? Wasn't sure off the top of my head 👀

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

If we had unified size prop to the icon component that would restrict sizes to the intended set. That wouldn’t be relevant/included in a pictogram component.

@joshblack
Copy link
Contributor

@vpicone wouldn't the case be that we just wouldn't pass in those props, or they would be undefined or bespoke, for the pictogram use-case? In other words:

// Icons
<Icon width={20} height={20} />
<Icon size="md" />

// Pictograms
<Icon width={64} height={48} />
<Icon />

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

That size prop would be broken for pictograms. Using it would result in rendering smaller than they are intended to be shown. It also wouldn’t make sense having “lg” render smaller than the default size.

@joshblack
Copy link
Contributor

@vpicone didn't mean for the prop values themselves to have any meaning really, just was trying to demonstrate that folks can pass them in or not and the underlying SVG would be fine. If we don't want folks to pass along a size prop then we don't forward that prop in the generated pictogram component 👍

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

@joshblack but we’re still calling them icons? Should they have a different display name/prop types?

@joshblack
Copy link
Contributor

@vpicone we could change the underlying name to SVG or something if you think it'd be less confusing, functionally these components seems to fill the same space so just was seeing if there was anything we could do to share the logic.

@chrisconnors-ibm
Copy link
Contributor

@vpicone let me track down the undefined

@chrisconnors-ibm
Copy link
Contributor

Across what attributes is search operating? It should be the same as icons scope and ordering.

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

@chrisconnors-ibm it is, with the removal of subcategories.

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

@joshblack what about the prop types? How would we differentiate that for icons vs pictograms

@joshblack
Copy link
Contributor

@vpicone I had assumed with the generated components, what do you think? Icon was originally intended to render any SVG asset with the correct a11y props.

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

@joshblack I think I just got confused with the component directory, I assumed it meant other components would go there not just Icon. I think yeah given Icons are a specific thing with different usage guidelines and props than Pictograms, we should rename the hardcoded Icon stuff to be something more inclusive of both components.

@chrisconnors-ibm
Copy link
Contributor

(although I bet the two we're adding in #4041 in in are the only ones with aliases)

@vpicone
Copy link
Contributor Author

vpicone commented Sep 25, 2019

@joshblack I removed the Pictogram component stuff, I think maybe I'm just misunderstanding how this abstraction is supposed to work. Opened #4090 to discuss further.

This now just fixes rendering bugs from the svgo optimization.

@vpicone vpicone requested a review from joshblack September 25, 2019 15:46
@vpicone vpicone merged commit cdde562 into carbon-design-system:master Sep 25, 2019
@vpicone vpicone deleted the pictograms-fix branch September 25, 2019 16:16
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.

[pictograms-react] Rendering issues and cleanup
4 participants