Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Style icons with CSS #2272

Merged
merged 10 commits into from
Apr 1, 2020
Merged

Style icons with CSS #2272

merged 10 commits into from
Apr 1, 2020

Conversation

jimbo
Copy link
Contributor

@jimbo jimbo commented Mar 19, 2020

Description

Style the Icon component with CSS rather than SVG attributes.

Related Issue

PWA-445

Acceptance

Verification Stakeholders

Specification

Verification Steps

  1. View icons throughout the site, verifying none have changed.
  2. Fill and empty your cart, verifying that the icon changes when you do.

Screenshots / Screen Captures (if appropriate)

Checklist

  • I have updated the documentation accordingly, if necessary.
  • I have added tests to cover my changes, if necessary.

@jimbo jimbo added the version: Major This changeset includes incompatible API changes and its release necessitates a Major version bump. label Mar 19, 2020
@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Mar 19, 2020

Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Associated JIRA tickets: PWA-445.

Generated by 🚫 dangerJS against f3168e1

composes: root from '../Icon/icon.css';
}

.icon--filled {
Copy link
Contributor

Choose a reason for hiding this comment

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

So instead of passing a color prop, if you want to override the filled color you would provide your own icon--filled class, right?

Copy link
Contributor

@sirugh sirugh left a comment

Choose a reason for hiding this comment

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

A few comments regarding propTypes but otherwise this looks good. Shouldn't be anything major that would hold this up though.

CartTrigger.propTypes = {
iconColor: string,
classes: shape({
root: string
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add any missing classes? This is our only documentation of the change.

attrs: shape({}),
classes: shape({
'icon--empty': string,
'icon--filled': string,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is accurate - we aren't passing icon--empty or icon--filled with classes. We apply one or the other to the Icon itself via className. It just happens to get spread onto the Icon through restProps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see what I did. I put the new classnames in the prop types for Icon rather than CartTrigger. I'll fix that.

As for className as a prop, you're right. The classify HOC allowed us to pass className as a shortcut override for classes.root, but its mergeClasses utility is simpler and doesn't have that feature. I'll update CartTrigger to override classes.root more explicitly.

sirugh
sirugh previously approved these changes Mar 26, 2020
@dpatil-magento
Copy link
Contributor

dpatil-magento commented Mar 26, 2020

@jimbo Pls take a look on following observations , PR (left) vs develop (Right)
1 No green border in Kebab icons, qty steppers ui.
2. No X icon, right mark in price check box and color .
3. Pagination icons differ.
4. Sort select icon, right mark missing.
image

image

@jimbo
Copy link
Contributor Author

jimbo commented Mar 30, 2020

  1. No green border in Kebab icons, qty steppers ui

Fixed both. Kebab icons are now slightly larger; stepper icons are now slightly smaller.

  1. No X icon, right mark in price check box and color

Fixed both. The synthetic checkboxes now use raw feather icons with a new appearance.

  1. Pagination icons differ.

Prefer the new unfilled style, so this is fine.

  1. Sort select icon, right mark missing.

Fixed. Checkmark now uses raw feather icons with a new appearance.

@dpatil-magento
Copy link
Contributor

@jimbo Fixes looks good but problem with paginations icons issue is, they don't get disabled when user is first or last page.

image

@jimbo
Copy link
Contributor Author

jimbo commented Mar 31, 2020

Fixes looks good but problem with paginations icons issue is, they don't get disabled when user is first or last page.

Good catch. Fixed. Also fixed the style of those buttons to be properly square and a bit larger (32x32).

@dpatil-magento
Copy link
Contributor

UI looks good on Chrome, Safari, firefox, android chrome. Good to merge once latest commits are reviewed.

Copy link
Contributor

@tjwiebell tjwiebell left a comment

Choose a reason for hiding this comment

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

Just need clarification on a redundant class, otherwise these changes look good 👍

composes: buttonArrow;
color: #999;
.root_disabled {
composes: root;
Copy link
Contributor

@tjwiebell tjwiebell Mar 31, 2020

Choose a reason for hiding this comment

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

This class seems a bit redundant. Did you intend to add additional styles, or should this instead just be:

.root:disabled {
  pointer-events: none;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point. I had included it as an optional classname to mirror the one for the icon, but the pseudo is probably sufficient for the root itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While I was fixing this, I noticed a few more bits of weird CSS in the pagination styles. These have been fixed. Please check those out too. @tjwiebell

@dpatil-magento dpatil-magento merged commit 25e8d20 into develop Apr 1, 2020
@dpatil-magento dpatil-magento deleted the jimbo/icon-style branch April 1, 2020 15:04
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
pkg:venia-ui version: Major This changeset includes incompatible API changes and its release necessitates a Major version bump.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants