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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Avatar] Add shape parameter #6103
Conversation
馃憢 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven鈥檛 already, please check out the contributing guidelines. |
size-limit report 馃摝
|
This reverts commit 3d2768f.
Co-authored-by: Kyle Durand <kyledurand@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 馃憤 Just watch out for the spacing issue I pointed out. I'm thinking this could use a test as well. Something like:
describe('shape', () => {
it('renders a square background when square is passed to shape', () => {
const avatar = mountWithApp(<Avatar initials="DL" shape="square" />);
expect(avatar).toContainReactComponent('span', {
className: expect.stringContaining('shapeSquare'),
});
});
});
@@ -96,6 +104,7 @@ export function Avatar({ | |||
size && styles[variationName('size', size)], | |||
!customer && styles[variationName('style', styleClass(nameString))], | |||
hasImage && status === Status.Loaded && styles.imageHasLoaded, | |||
shape && styles[variationName('shape',shape)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shape && styles[variationName('shape',shape)], | |
shape && styles[variationName('shape',shape)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @clarkjennings!! 馃檶馃徑 Just had a question of the recommended context to use square
vs round
in the Admin. Thank you for contributing!! 馃帀
@@ -115,6 +115,14 @@ function ExtraSmallAvatarExample() { | |||
} | |||
``` | |||
|
|||
### Square avatar | |||
|
|||
Use to present a square shaped for a merchant, customer, or business. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the shape we want avatars to be going forward when representing all merchants (and their staff?) once unified Admin launches? Or is this just for Plus merchants?
Use to present a square shaped for a merchant, customer, or business. | |
Use a `square` `shape` when the avatar represents the merchant. |
Co-authored-by: Chloe Rice <chloerice@users.noreply.github.com>
馃帀 Thanks for your contribution to Polaris! |
WHY are these changes introduced?
Add a way to create a square shaped Avatar for plus stores in Plus Admin Migration
Related to Businesses issues #1391 and #1392.
WHAT is this pull request doing?
Add an optional parameter "shape" to the Avatar component. Defaults to
round
for no change in behavior or appearance. Ifsquare
is supplied instead, the Avatar will have a 2px border-radius instead of 50%, resulting in a square shape with slightly rounded corners.Copy-paste this code in
playground/Playground.tsx
:馃帺 checklist
README.md
with documentation changes