Skip to content

Commit

Permalink
improve conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Jul 9, 2024
1 parent 0c08128 commit aabc47d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/edit-site/src/components/posts-app/posts-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,13 @@ function PostAuthorField( { item, viewType } ) {
},
[ item ]
);
const withIcon = viewType !== LAYOUT_LIST;

const withAuthorImage = viewType !== LAYOUT_LIST && imageUrl;
const withAuthorIcon = viewType !== LAYOUT_LIST && ! imageUrl;
const [ isImageLoaded, setIsImageLoaded ] = useState( false );
return (
<HStack alignment="left" spacing={ 1 }>
{ withIcon && imageUrl && (
{ withAuthorImage && (
<div
className={ clsx( 'page-templates-author-field__avatar', {
'is-loaded': isImageLoaded,
Expand All @@ -247,7 +249,7 @@ function PostAuthorField( { item, viewType } ) {
/>
</div>
) }
{ withIcon && ! imageUrl && (
{ withAuthorIcon && (
<div className="page-templates-author-field__icon">
<Icon icon={ icon } />
</div>
Expand Down

0 comments on commit aabc47d

Please sign in to comment.