Make feed create avatar not load glitchily

This commit is contained in:
jahooma 2022-01-27 00:49:23 -06:00
parent 769763d006
commit d83fe1a202
2 changed files with 10 additions and 5 deletions

View File

@ -58,6 +58,10 @@ export function AvatarWithIcon(props: { username: string; avatarUrl: string }) {
) )
} }
export function AvatarPlaceholder() {
return <div className="rounded-full bg-gray-400 w-10 h-10" />
}
function FeedComment(props: { function FeedComment(props: {
activityItem: any activityItem: any
moreHref: string moreHref: string

View File

@ -1,4 +1,4 @@
import { AvatarWithIcon } from './contract-feed' import { AvatarPlaceholder, AvatarWithIcon } from './contract-feed'
import { Title } from './title' import { Title } from './title'
import Textarea from 'react-expanding-textarea' import Textarea from 'react-expanding-textarea'
import { useState } from 'react' import { useState } from 'react'
@ -74,10 +74,11 @@ export default function FeedCreate(props: { user?: User }) {
return ( return (
<div className="w-full bg-indigo-50 sm:rounded-md p-4"> <div className="w-full bg-indigo-50 sm:rounded-md p-4">
<div className="relative flex items-start space-x-3"> <div className="relative flex items-start space-x-3">
<AvatarWithIcon {user?.avatarUrl ? (
username={user?.username || ''} <AvatarWithIcon username={user.username} avatarUrl={user.avatarUrl} />
avatarUrl={user?.avatarUrl || ''} ) : (
/> <AvatarPlaceholder />
)}
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
{/* TODO: Show focus, for accessibility */} {/* TODO: Show focus, for accessibility */}