Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Migrate Avatar to new Compound component #11393

Closed
wants to merge 3 commits into from

Conversation

germain-gg
Copy link
Contributor

@germain-gg germain-gg commented Aug 9, 2023

Uses https://compound.element.io/?path=/story/compound-web_avatar--round

Screenshot 2023-08-09 at 15 43 51 Screenshot 2023-08-09 at 15 44 05

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Here's what your changelog entry will look like:

✨ Features

  • Migrate Avatar to new Compound component (#11393).

@germain-gg germain-gg requested review from a team as code owners August 9, 2023 14:51
@germain-gg germain-gg changed the title Remove unused defaultToInitialLetter prop Migrate Avatar to new Compound component Aug 9, 2023
@germain-gg germain-gg added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Aug 9, 2023
/>
);
}
return (
Copy link
Member

Choose a reason for hiding this comment

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

Looks like onClick is unused

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, not sure why ESLint was not shouting at me, back in use now.

Copy link
Member

Choose a reason for hiding this comment

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

The rule is disabled on this block

Copy link
Member

Choose a reason for hiding this comment

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

@@ -82,7 +82,7 @@ export default class RoomAvatarEvent extends React.Component<IProps> {
className="mx_RoomAvatarEvent_avatar"
onClick={this.onAvatarClick}
>
<RoomAvatar width={14} height={14} oobData={oobData} />
<RoomAvatar width={16} oobData={oobData} />
Copy link
Member

Choose a reason for hiding this comment

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

Can this happen in a different PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not quite, the new avatar uses box-sizing: border-box, so if i do not do that change the avatars end up being two pixels smaller.

Copy link
Member

Choose a reason for hiding this comment

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

image

But it looks like it genuinely wants a 14px (OD) avatar?

altText = _t("Avatar"),
ariaLabel = _t("Avatar"),
Copy link
Member

Choose a reason for hiding this comment

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

Losing this seems bad, this is the aria-label for the button which wraps clickable avatars

@t3chguy t3chguy added the X-Needs-Percy Whether to run Percy screenshot tests in Merge Queue label Aug 9, 2023
@t3chguy
Copy link
Member

t3chguy commented Aug 9, 2023

Any chance of screenshots of more variants, with globe cutout, with online indicator cutout, user info (large), space home, etc etc

Comment on lines -159 to -160
aria-label={ariaLabel}
aria-live="off"
Copy link
Member

Choose a reason for hiding this comment

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

Losing these seems bad

);
const imgNode = (
<img
loading="lazy"
Copy link
Member

Choose a reason for hiding this comment

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

Losing this seems bad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines -151 to -152
aria-hidden="true"
data-testid="avatar-img"
Copy link
Member

Choose a reason for hiding this comment

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

Losing these seems bad

className={classNames("mx_BaseAvatar", className)}
ref={inputRef}
{...otherProps}
role="presentation"
Copy link
Member

Choose a reason for hiding this comment

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

Losing this seems bad

Comment on lines +40 to 43
/**
* @deprecated use `width` only, avatars have a 1:1 aspect ratio
*/
height: number;
Copy link
Member

@t3chguy t3chguy Aug 9, 2023

Choose a reason for hiding this comment

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

Can we just kill it? We're not a real SDK so don't need backwards compatibility, confusion is worse than bigger diffs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! I will rename width to size in a follow up PR

@germain-gg
Copy link
Contributor Author

Supplemented by #11448.
PR got stale, unfortunately

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements X-Needs-Percy Whether to run Percy screenshot tests in Merge Queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants