Skip to content

Commit 20ff3e3

Browse files
authored
Ensure there is a thumbnail for videos on web (#9019)
1 parent 5b8631d commit 20ff3e3

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/components/Post/Embed/VideoEmbed/VideoEmbedInner/VideoFallback.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import {msg, Trans} from '@lingui/macro'
33
import {useLingui} from '@lingui/react'
44

55
import {atoms as a, useTheme} from '#/alf'
6-
import {Button, ButtonText} from '#/components/Button'
6+
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
7+
import {ArrowRotateCounterClockwise_Stroke2_Corner0_Rounded as ArrowRotateIcon} from '#/components/icons/ArrowRotateCounterClockwise'
8+
import {MediaInsetBorder} from '#/components/MediaInsetBorder'
79
import {Text as TypoText} from '#/components/Typography'
810

911
export function Container({children}: {children: React.ReactNode}) {
@@ -16,12 +18,12 @@ export function Container({children}: {children: React.ReactNode}) {
1618
a.justify_center,
1719
a.align_center,
1820
a.px_lg,
19-
a.border,
20-
t.atoms.border_contrast_low,
21-
a.rounded_sm,
21+
a.rounded_md,
22+
a.overflow_hidden,
2223
a.gap_lg,
2324
]}>
2425
{children}
26+
<MediaInsetBorder />
2527
</View>
2628
)
2729
}
@@ -50,8 +52,8 @@ export function RetryButton({onPress}: {onPress: () => void}) {
5052
onPress={onPress}
5153
size="small"
5254
color="secondary_inverted"
53-
variant="solid"
5455
label={_(msg`Retry`)}>
56+
<ButtonIcon icon={ArrowRotateIcon} />
5557
<ButtonText>
5658
<Trans>Retry</Trans>
5759
</ButtonText>

src/components/Post/Embed/VideoEmbed/index.web.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ export function VideoEmbed({
8686
const contents = (
8787
<div
8888
ref={ref}
89-
style={{display: 'flex', flex: 1, cursor: 'default'}}
89+
style={{
90+
display: 'flex',
91+
flex: 1,
92+
cursor: 'default',
93+
backgroundImage: `url(${embed.thumbnail})`,
94+
backgroundSize: 'cover',
95+
}}
9096
onClick={evt => evt.stopPropagation()}>
9197
<ErrorBoundary renderError={renderError} key={key}>
9298
<OnlyNearScreen>

0 commit comments

Comments
 (0)