Skip to content

Commit

Permalink
fix(#976): add default Img src for speaker picture (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
CruuzAzul authored May 6, 2024
1 parent 4b901e3 commit 48b51ab
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
AbsoluteFill,
interpolate,
spring,
staticFile,
useCurrentFrame,
useVideoConfig,
} from 'remotion';
Expand Down Expand Up @@ -59,12 +58,7 @@ export const Speakers: React.FC<{speakers: Speaker[]}> = ({speakers}) => {
}}
>
<AvatarWithCaption
avatarPictureUrl={
speaker.picture ||
staticFile(
'images/showcases/campingDesSpeakers/campingDesSpeakersLogo.png',
)
}
avatarPictureUrl={speaker.picture}
avatarStyle={{
width: 180,
height: 180,
Expand Down
8 changes: 1 addition & 7 deletions remotion/compositions/showcases/devfestLille/Speakers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
AbsoluteFill,
interpolate,
spring,
staticFile,
useCurrentFrame,
useVideoConfig,
} from 'remotion';
Expand Down Expand Up @@ -58,12 +57,7 @@ export const Speakers: React.FC<{speakers: Speaker[]}> = ({speakers}) => {
}}
>
<AvatarWithCaption
avatarPictureUrl={
speaker.picture ||
staticFile(
'images/showcases/campingDesSpeakers/campingDesSpeakersLogo.png',
)
}
avatarPictureUrl={speaker.picture}
avatarStyle={{
width: 180,
height: 180,
Expand Down
8 changes: 1 addition & 7 deletions remotion/compositions/showcases/devfestNantes/Speakers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
AbsoluteFill,
interpolate,
spring,
staticFile,
useCurrentFrame,
useVideoConfig,
} from 'remotion';
Expand Down Expand Up @@ -58,12 +57,7 @@ export const Speakers: React.FC<{speakers: Speaker[]}> = ({speakers}) => {
}}
>
<AvatarWithCaption
avatarPictureUrl={
speaker.picture ||
staticFile(
'images/showcases/campingDesSpeakers/campingDesSpeakersLogo.png',
)
}
avatarPictureUrl={speaker.picture}
avatarStyle={{
width: 180,
height: 180,
Expand Down
13 changes: 11 additions & 2 deletions remotion/compositions/showcases/volcamp/components/Speakers.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import {Img, spring, useCurrentFrame, useVideoConfig} from 'remotion';
import {
Img,
spring,
staticFile,
useCurrentFrame,
useVideoConfig,
} from 'remotion';

import {Text} from '../../../../design/atoms/Text';

Expand Down Expand Up @@ -102,7 +108,10 @@ export const Speakers: React.FC<speakerProps> = ({speakers}) => {
</span>
)}
<Img
src={speaker.picture}
src={
speaker.picture ||
staticFile('images/common/defaultAvatar.svg')
}
alt={`Picture of ${speaker.name}`}
width={130}
height={130}
Expand Down
3 changes: 2 additions & 1 deletion remotion/design/molecules/AvatarWithCaption.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {ReactNode} from 'react';
import {staticFile} from 'remotion';

import {Avatar} from '../atoms/Avatar';
import {Text} from '../atoms/Text';
Expand Down Expand Up @@ -35,7 +36,7 @@ export const AvatarWithCaption: React.FC<{
position: 'relative',
...avatarStyle,
}}
src={avatarPictureUrl}
src={avatarPictureUrl || staticFile('images/common/defaultAvatar.svg')}
/>
{!children && (
<Text
Expand Down

0 comments on commit 48b51ab

Please sign in to comment.