Skip to content

Commit

Permalink
templates: fix media block generating an error if referenced media is…
Browse files Browse the repository at this point in the history
… missing (#10310)

Fixes #10231
  • Loading branch information
paulpopus authored Jan 2, 2025
1 parent 7928eca commit 951c38e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions templates/website/src/blocks/MediaBlock/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ export const MediaBlock: React.FC<Props> = (props) => {
className,
)}
>
<Media
imgClassName={cn('border border-border rounded-[0.8rem]', imgClassName)}
resource={media}
src={staticImage}
/>
{(media || staticImage) && (
<Media
imgClassName={cn('border border-border rounded-[0.8rem]', imgClassName)}
resource={media}
src={staticImage}
/>
)}
{caption && (
<div
className={cn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ export const MediaBlock: React.FC<Props> = (props) => {
className,
)}
>
<Media
imgClassName={cn('border border-border rounded-[0.8rem]', imgClassName)}
resource={media}
src={staticImage}
/>
{(media || staticImage) && (
<Media
imgClassName={cn('border border-border rounded-[0.8rem]', imgClassName)}
resource={media}
src={staticImage}
/>
)}
{caption && (
<div
className={cn(
Expand Down

0 comments on commit 951c38e

Please sign in to comment.