Skip to content

Conversation

kyledurand
Copy link
Member

@kyledurand kyledurand commented Nov 21, 2019

WHY are these changes introduced?

Fixes part of: https://github.com/Shopify/polaris-ux/issues/333
Fixes: https://github.com/Shopify/polaris-ux/issues/92

Before After

WHAT is this pull request doing?

Customer avatars are mostly unhelpful and sometimes straight up confusing. This PR replaces the multiple images with one default gray version.

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';
import {
  ResourceList,
  ResourceItem,
  Card,
  Page,
  Avatar,
  Stack,
  TextStyle,
} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      <Card>
        <Card.Section>
          <Stack alignment="baseline">
            <Avatar initials="KD" name="d" />
            <Avatar initials="KD" name="e" />
            <Avatar initials="KD" name="f" />
            <Avatar initials="KD" name="g" />
            <Avatar initials="KD" name="h" />
            <div
              style={{borderLeft: '1px solid hsl(0, 0%, 50%)', height: '40px'}}
            />
            <Avatar customer initials="KD" name="e" />
            <Avatar
              initials="JD"
              name="John D"
              source="https://images.unsplash.com/photo-1574157573248-293553e90ead?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1534&q=80"
            />
          </Stack>
        </Card.Section>
        <Card.Section>
          <Card>
            <ResourceList
              resourceName={{singular: 'customer', plural: 'customers'}}
              items={[
                {
                  id: 257,
                  url: 'customers/256',
                  name: 'Carl Winslow',
                  location: 'Los Angeles, USA',
                },
                {
                  id: 258,
                  url: 'customers/256',
                  name: 'Harriette Winslow',
                  location: 'Los Angeles, USA',
                },
                {
                  id: 259,
                  url: 'customers/256',
                  name: 'Edward "Eddie" Winslow',
                  location: 'Los Angeles, USA',
                },
                {
                  id: 260,
                  url: 'customers/256',
                  name: 'Laura Lee Winslow',
                  location: 'Los Angeles, USA',
                },
                {
                  id: 261,
                  url: 'customers/256',
                  name: 'Judith "Judy" Winslow',
                  location: 'Los Angeles, USA',
                },
                {
                  id: 262,
                  url: 'customers/256',
                  name: 'Steven "Steve" Quincy Urkel',
                  location: 'Los Angeles, USA',
                },
              ]}
              renderItem={(item) => {
                const {id, url, name, location} = item;
                const media = <Avatar customer size="medium" name={name} />;
                return (
                  <ResourceItem
                    id={id}
                    url={url}
                    media={media}
                    accessibilityLabel={`View details for ${name}`}
                  >
                    <h3>
                      <TextStyle variation="strong">{name}</TextStyle>
                    </h3>
                    <div>{location}</div>
                  </ResourceItem>
                );
              }}
            />
          </Card>
        </Card.Section>
      </Card>
    </Page>
  );
}

🎩 checklist

@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2019

🟡 This pull request modifies 14 files and might impact 13 other files. This is an average splash zone for a change, remember to tophat areas that could be affected.

Details:
All files potentially affected (total: 13)
📄 UNRELEASED.md (total: 0)

Files potentially affected (total: 0)

🎨 src/components/Avatar/Avatar.scss (total: 13)

Files potentially affected (total: 13)

🧩 src/components/Avatar/Avatar.tsx (total: 12)

Files potentially affected (total: 12)

📄 src/components/Avatar/images/avatar-1.svg (total: 0)

Files potentially affected (total: 0)

📄 src/components/Avatar/images/avatar-2.svg (total: 0)

Files potentially affected (total: 0)

📄 src/components/Avatar/images/avatar-3.svg (total: 0)

Files potentially affected (total: 0)

📄 src/components/Avatar/images/avatar-4.svg (total: 0)

Files potentially affected (total: 0)

📄 src/components/Avatar/images/avatar-5.svg (total: 0)

Files potentially affected (total: 0)

📄 src/components/Avatar/images/avatar-6.svg (total: 0)

Files potentially affected (total: 0)

📄 src/components/Avatar/images/avatar-7.svg (total: 0)

Files potentially affected (total: 0)

📄 src/components/Avatar/images/avatar-8.svg (total: 0)

Files potentially affected (total: 0)

📄 src/components/Avatar/images/avatar-9.svg (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Avatar/images/index.ts (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Avatar/tests/Avatar.test.tsx (total: 0)

Files potentially affected (total: 0)

@kyledurand kyledurand force-pushed the avatar_remove-customer-images branch from 63ef11d to f209e5e Compare November 21, 2019 16:30
@kyledurand
Copy link
Member Author

@sarahill I'm in no rush to get this merged but I think we'll have to update the UI kit when it does

Copy link
Contributor

@sarahill sarahill left a comment

Choose a reason for hiding this comment

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

This is looking good! Noticed a couple things:

Hover states
When you hover on a list item the avatars get pretty lost.

Suggestion: Add a 2px white border to help it stand out a little more.

Screen Shot 2019-11-22 at 10 25 31 AM

High contrast mode
In windows high contrast mode the background of the avatars isn't visible.

Suggestion: Add a border to give these a container.

Before After
Screen Shot 2019-11-22 at 10 26 38 AM Screen Shot 2019-11-22 at 10 34 46 AM

Copy link
Member

@chloerice chloerice left a comment

Choose a reason for hiding this comment

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

💯on adding a border for contrast. Code-wise this looks good to me 🚀

@kyledurand kyledurand force-pushed the avatar_remove-customer-images branch from f209e5e to a51e76b Compare January 20, 2020 21:10

@media (-ms-high-contrast: active) {
border: 1px solid ms-high-contrast-color('text');
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@sarahill I've finally been able to circle back to this and add a border for high contrast mode:

image

@kyledurand kyledurand force-pushed the avatar_remove-customer-images branch from a51e76b to 413934d Compare January 20, 2020 21:18
@kyledurand kyledurand force-pushed the avatar_remove-customer-images branch from 413934d to efbd5cd Compare January 21, 2020 15:29
@kyledurand kyledurand changed the title [Avavtar] Remove customer images [Avatar] Remove customer images Jan 21, 2020
@sarahill sarahill self-requested a review January 24, 2020 20:45
Copy link
Contributor

@sarahill sarahill left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks, Kyle!

@kyledurand kyledurand force-pushed the avatar_remove-customer-images branch from efbd5cd to ca648e7 Compare January 27, 2020 21:10
@kyledurand kyledurand force-pushed the avatar_remove-customer-images branch from ca648e7 to 16212ae Compare January 27, 2020 22:01
@kyledurand kyledurand force-pushed the avatar_remove-customer-images branch from 16212ae to b9ba7fe Compare January 27, 2020 22:01
@kaelig
Copy link
Contributor

kaelig commented Jan 28, 2020

Hey Kyle, does this call for a style guide update? (Avatars spotted in https://polaris.shopify.com/design/illustrations#section-partner-resources)

@kyledurand
Copy link
Member Author

does this call for a style guide update?

I believe so! I've asked Sara to update the UI kit but if the styleguide won't be updated automatically then we'll have to do it there as well. Want to pair on that @kaelig?

@sarahill
Copy link
Contributor

sarahill commented Jan 28, 2020 via email

@kyledurand kyledurand merged commit bb917b7 into master Jan 28, 2020
@kyledurand kyledurand deleted the avatar_remove-customer-images branch January 28, 2020 18:33
</span>
) : null;
const avatarBody = customer ? (
<g fill="currentColor" fillRule="nonzero">
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @kyledurand – as I was looking at the component, I noticed this minor refactor opportunity:

- <g fill="currentColor" fillRule="nonzero">
-   <path d="M8.28 27.5A14.95 14.95 0 0120 21.8c4.76 0 8.97 2.24 11.72 5.7a14.02 14.02 0 01-8.25 5.91 14.82 14.82 0 01-6.94 0 14.02 14.02 0 01-8.25-5.9zM13.99 12.78a6.02 6.02 0 1112.03 0 6.02 6.02 0 01-12.03 0z" />
- </g>
+ <path fill="currentColor" d="M8.28 27.5A14.95 14.95 0 0120 21.8c4.76 0 8.97 2.24 11.72 5.7a14.02 14.02 0 01-8.25 5.91 14.82 14.82 0 01-6.94 0 14.02 14.02 0 01-8.25-5.9zM13.99 12.78a6.02 6.02 0 1112.03 0 6.02 6.02 0 01-12.03 0z" />

Not a huge win, but I thought I'd bring it up in case you go back to this at some point!

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice find! I have another Avatar PR up so I just made the change there: 72f8997

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.

5 participants