From adefd3259c9d4880cac8cc1161c988c9c0554852 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Thu, 5 May 2022 09:50:58 -0700 Subject: [PATCH] Cleanup avatar component rendering (#130) * Remove unnecessary classes on avatar img I don't believe these have any visible effect. * Don't apply Tailwind 'avatar' class in menu We don't use this class elsewhere when displaying avatars (instead our avatar has manual styles that do the stuff Tailwind is trying to do) and it just assigns a weird size that we don't want. If we want to use the Tailwind avatar styles we should refactor further. * Remove unnecessary avatar wrapper div * Remove old prop from avatar --- web/components/avatar.tsx | 48 +++++++++++++---------------- web/components/nav/nav-bar.tsx | 2 +- web/components/nav/profile-menu.tsx | 2 +- 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/web/components/avatar.tsx b/web/components/avatar.tsx index 318c5498..706b61f3 100644 --- a/web/components/avatar.tsx +++ b/web/components/avatar.tsx @@ -8,10 +8,8 @@ export function Avatar(props: { noLink?: boolean size?: number | 'xs' | 'sm' className?: string - containerClassName?: string }) { - const { username, avatarUrl, noLink, size, className, containerClassName } = - props + const { username, avatarUrl, noLink, size, className } = props const s = size == 'xs' ? 6 : size === 'sm' ? 8 : size || 10 const onClick = @@ -21,32 +19,28 @@ export function Avatar(props: { e.stopPropagation() Router.push(`/${username}`) } - return ( -
- {avatarUrl ? ( - {username} - ) : ( - // TODO: After 2022-03-01, can just assume that all contracts have an avatarUrl -