Merge branch 'main' into manalink
This commit is contained in:
commit
ffd723a406
|
@ -8,8 +8,10 @@ export function Avatar(props: {
|
||||||
noLink?: boolean
|
noLink?: boolean
|
||||||
size?: number | 'xs' | 'sm'
|
size?: number | 'xs' | 'sm'
|
||||||
className?: string
|
className?: string
|
||||||
|
containerClassName?: string
|
||||||
}) {
|
}) {
|
||||||
const { username, avatarUrl, noLink, size, className } = props
|
const { username, avatarUrl, noLink, size, className, containerClassName } =
|
||||||
|
props
|
||||||
const s = size == 'xs' ? 6 : size === 'sm' ? 8 : size || 10
|
const s = size == 'xs' ? 6 : size === 'sm' ? 8 : size || 10
|
||||||
|
|
||||||
const onClick =
|
const onClick =
|
||||||
|
@ -19,13 +21,17 @@ export function Avatar(props: {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
Router.push(`/${username}`)
|
Router.push(`/${username}`)
|
||||||
}
|
}
|
||||||
|
return (
|
||||||
// there can be no avatar URL or username in the feed, we show a "submit comment"
|
<div
|
||||||
// item with a fake grey user circle guy even if you aren't signed in
|
className={clsx(
|
||||||
return avatarUrl ? (
|
`flex-shrink-0 rounded-full bg-white w-${s} h-${s}`,
|
||||||
|
containerClassName
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{avatarUrl ? (
|
||||||
<img
|
<img
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'flex-shrink-0 rounded-full rounded-full bg-white object-cover',
|
'flex items-center justify-center rounded-full object-cover',
|
||||||
`w-${s} h-${s}`,
|
`w-${s} h-${s}`,
|
||||||
!noLink && 'cursor-pointer',
|
!noLink && 'cursor-pointer',
|
||||||
className
|
className
|
||||||
|
@ -35,12 +41,12 @@ export function Avatar(props: {
|
||||||
alt={username}
|
alt={username}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
// TODO: After 2022-03-01, can just assume that all contracts have an avatarUrl
|
||||||
<UserCircleIcon
|
<UserCircleIcon
|
||||||
className={clsx(
|
className={`w-${s} h-${s} text-gray-500`}
|
||||||
`flex-shrink-0 rounded-full bg-white w-${s} h-${s} text-gray-500`,
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ export function BottomNavBar() {
|
||||||
) : user ? (
|
) : user ? (
|
||||||
<>
|
<>
|
||||||
<Avatar
|
<Avatar
|
||||||
className="mx-auto my-1"
|
containerClassName={'mx-auto my-1'}
|
||||||
size="xs"
|
size="xs"
|
||||||
username={user.username}
|
username={user.username}
|
||||||
avatarUrl={user.avatarUrl}
|
avatarUrl={user.avatarUrl}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user