Skip to content

Commit

Permalink
Show spinner whilst fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Feb 9, 2023
1 parent 33e79b6 commit 17178a9
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions packages/block-library/src/link-preview/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export default function LinkPreviewEdit( props ) {
<Button variant="primary" type="submit">
{ _x( 'Embed', 'button label' ) }
</Button>
{ isFetching && <Spinner /> }
</form>
</Placeholder>
</div>
Expand All @@ -111,18 +110,27 @@ export default function LinkPreviewEdit( props ) {
/>
</ToolbarGroup>
</BlockControls>
{ image && <img src={ image } alt={ title } /> }
<div>
{ title && <strong>{ title }</strong> }
{ icon && (
<img
className="link-preview__icon"
src={ icon }
alt={ new URL( url ).host }
/>
) }
{ title ? new URL( url ).host.replace( /^www\./, '' ) : url }
</div>

{ isFetching && <Spinner /> }

{ ! isFetching && (
<>
{ image && <img src={ image } alt={ title } /> }
<div>
{ title && <strong>{ title }</strong> }
{ icon && (
<img
className="link-preview__icon"
src={ icon }
alt={ new URL( url ).host }
/>
) }
{ title
? new URL( url ).host.replace( /^www\./, '' )
: url }
</div>
</>
) }
</a>
);
}

0 comments on commit 17178a9

Please sign in to comment.