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): updated star icons, added star ratings #1585

Merged
merged 2 commits into from
Dec 1, 2021

Conversation

austingardner
Copy link
Contributor

Description

Updated individual star icons, as well as added the "star ratings" icons - which are rows of stars that allow ratings to be quickly displayed.

Context

One issue I ran into was that certain icons with two colors can't be filled by default, and I'm not sure how I would change their colors with CSS. So I ended up having a "light" mode and a "dark" mode for star-half as well as the "star ratings" icons. Maybe we can come up with a better solution in the future.

References

closes #1473

Screenshots

Screen Shot 2021-10-19 at 5 00 14 PM

Screen Shot 2021-10-19 at 5 00 19 PM

Screen Shot 2021-10-19 at 5 00 30 PM

Screen Shot 2021-10-19 at 5 00 33 PM

Screen Shot 2021-10-19 at 5 00 45 PM

Screen Shot 2021-10-19 at 5 00 53 PM

Screen Shot 2021-10-19 at 5 01 02 PM

Screen Shot 2021-10-19 at 5 01 11 PM

Copy link
Contributor

@ianmcburnie ianmcburnie left a comment

Choose a reason for hiding this comment

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

I think we'll need to come up with a better approach that leverages pure CSS. Dark mode can only trigger a CSS media query, it can't modify HTML.

How about if the star-half SVG contains two paths (left side and right side), and each path has a class that can be targeted in the media query? Then you can modify its fill/color. You might not need even need class, maybe just nth child selector will do.

If this works we can then delete star-half-dark.

@ianmcburnie
Copy link
Contributor

ianmcburnie commented Nov 10, 2021

This seems to work pretty well for both color modes:

<symbol id="icon-star-half" viewBox="0 0 22 22">
  <path d="M11.0438 2.19068C11.3425 1.26977 12.6576 1.26977 12.9563 2.19068L15.0889 9H22C22.9704 9 23.3703 9.97367 22.5883 10.5428L16.9876 14.6188L19.1211 21.1958C19.4191 22.1146 18.3552 22.8737 17.5702 22.3024L12 18.2486L6.42991 22.3024C5.64488 22.8737 4.58098 22.1146 4.879 21.1958L7.01242 14.6188L1.41178 10.5428C0.629732 9.97367 1.04239 9 2.01275 9H8.92386L11.0438 2.19068Z" style="filter: opacity(0.25)"/>
  <path d="M6.42993 22.3024L12.0001 18.2486V1.5C11.5966 1.5 11.1931 1.73023 11.0438 2.19068L8.92388 9H2.01277C1.04241 9 0.62975 9.97367 1.4118 10.5428L7.01244 14.6188L4.87902 21.1958C4.581 22.1146 5.6449 22.8737 6.42993 22.3024Z" />
</symbol>

The trick is style="filter: opacity(0.25)"

Might just need a little fine tuning to get the right shade/opacity.

Screen Shot 2021-11-10 at 2 30 18 PM
Screen Shot 2021-11-10 at 2 30 26 PM

@austingardner You could apply the same technique to the star ratings and then go ahead and delete all the "dark" versions.

p.s. I also added an update to Gulp which now auto syncs the SVG, without needing to stop the server and rebuild.

@austingardner
Copy link
Contributor Author

Okay I think they're ready!
here's how things look after applying the filter: opacity(0.25) strategy:

Screen Shot 2021-11-11 at 5 40 14 PM

Screen Shot 2021-11-11 at 5 40 23 PM

Screen Shot 2021-11-11 at 5 40 31 PM

Screen Shot 2021-11-11 at 5 40 43 PM

Screen Shot 2021-11-11 at 5 40 52 PM

Screen Shot 2021-11-11 at 5 41 01 PM

@ianmcburnie
Copy link
Contributor

One general comment is that we might want to start looking into breaking up this large icon file by type, e.g. star series, shipping, navigation, etc. The file is getting pretty huge now (~123kb).

We could do this in a backwards compatible way where @ebay/skin/icon brings in a file with all icons, but also have submodules for specific files, e.g.@ebay/skin/icon/stars, @ebay/skin/icon/shipping.

We'd need a simple package script that would stitch all the individual files together into the large file.

@austingardner
Copy link
Contributor Author

One general comment is that we might want to start looking into breaking up this large icon file by type, e.g. star series, shipping, navigation, etc. The file is getting pretty huge now (~123kb).

We could do this in a backwards compatible way where @ebay/skin/icon brings in a file with all icons, but also have submodules for specific files, e.g.@ebay/skin/icon/stars, @ebay/skin/icon/shipping.

We'd need a simple package script that would stitch all the individual files together into the large file.

I'd be interested in taking that project on!

@ianmcburnie
Copy link
Contributor

So the more I look at it, I'm not sure that star ratings belong in the icon file. They don't feel like icons. They feel like a different thing altogether. I'm going to either move or comment them out of this PR temporarily and then we can revisit in #1599

@ianmcburnie ianmcburnie self-assigned this Nov 18, 2021
@agliga
Copy link
Contributor

agliga commented Nov 30, 2021

So the more I look at it, I'm not sure that star ratings belong in the icon file. They don't feel like icons. They feel like a different thing altogether. I'm going to either move or comment them out of this PR temporarily and then we can revisit in #1599

We can probably do something similar like we did with program-badge and have a star-rating file.

@ianmcburnie
Copy link
Contributor

Yep, I think that's what I'll go with.

@ianmcburnie
Copy link
Contributor

ianmcburnie commented Dec 1, 2021

So I separated out the star-rating from icon into its own module. This addresses the non-interactive part of #1599. The interactive star rating can be tackled in a future PR.

Some other cleanup:

  • Removed all star rating BEM modifiers, given that they all have the same width and height
  • Removed the "foreground-" prefix from icon, program badge and star-rating. This naming is a left over from when we had background icons
  • Cleaned up program-badge.less by grouping selectors
  • Prettified the program-badge section of website (used same layout as icons section)

Screen Shot 2021-11-30 at 9 07 10 PM

Screen Shot 2021-11-30 at 9 24 39 PM

Screen Shot 2021-11-30 at 8 51 36 PM

Copy link
Contributor

@agliga agliga left a comment

Choose a reason for hiding this comment

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

Love the new changes! They look great and much cleaner! Bravo!

@ianmcburnie ianmcburnie merged commit 2e0a4bd into 13.2.0 Dec 1, 2021
@ianmcburnie ianmcburnie deleted the 1473-update-rating-star branch February 3, 2022 02:40
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.

3 participants