Skip to content

Commit c156b27

Browse files
authored
Merge pull request #818 from AppQuality/fix-video-list-poster
🎨 add(placeholder-video.svg): add placeholder video SVG icon
2 parents 9849da6 + 083ce58 commit c156b27

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed
Lines changed: 14 additions & 0 deletions
Loading

src/pages/Videos/parts/VideoItem.tsx

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { GetCampaignsByCidVideoApiResponse } from 'src/features/api';
55
import { useLocalizeRoute } from 'src/hooks/useLocalizedRoute';
66
import { styled } from 'styled-components';
77
import { getColorWithAlpha } from 'src/common/utils';
8+
import { ReactComponent as PlaceholderVideo } from 'src/assets/icons/placeholder-video.svg';
89
import { getSeverityTagsByVideoCount } from '../utils/getSeverityTagsWithCount';
910

1011
const Container = styled.div`
@@ -19,31 +20,27 @@ const Container = styled.div`
1920
`;
2021

2122
const ThumbnailContainer = styled.div`
22-
background-color: ${({ theme }) => theme.palette.black};
23-
width: 106px;
2423
display: flex;
25-
align-items: center;
2624
justify-content: center;
27-
margin-bottom: ${({ theme }) => theme.space.xxs};
25+
align-items: center;
26+
background-color: ${({ theme }) => theme.palette.black};
27+
height: 70px;
28+
width: 110px;
29+
overflow: hidden;
30+
31+
> img,
32+
svg {
33+
width: 100%;
34+
height: auto;
35+
}
2836
`;
29-
const StyledAnchor = styled(Anchor)<{ disabled?: boolean }>`
30-
width: 100%;
3137

32-
${({ disabled }) =>
33-
disabled &&
34-
`
35-
pointer-events: none;
36-
cursor: default;
37-
`}
38+
const StyledAnchor = styled(Anchor)`
39+
width: 100%;
3840
3941
&:hover {
4042
text-decoration: none;
4143
}
42-
43-
video {
44-
width: 100%;
45-
height: 68px;
46-
}
4744
`;
4845

4946
const ObservationsTotalContainer = styled.div`
@@ -56,25 +53,15 @@ const Poster = ({
5653
video,
5754
}: {
5855
video: GetCampaignsByCidVideoApiResponse['items'][number]['videos'][number];
59-
}) => {
60-
if (video.poster) {
61-
return (
62-
<img
63-
src={video.poster}
64-
alt={`video poster preview of video ${video.id}`}
65-
/>
66-
);
67-
}
68-
69-
return (
70-
<ThumbnailContainer>
71-
<video>
72-
<source src={`${video.url}#t0.5`} type="video/mp4" />
73-
<track kind="captions" />
74-
</video>
75-
</ThumbnailContainer>
76-
);
77-
};
56+
}) => (
57+
<ThumbnailContainer>
58+
{video.poster ? (
59+
<img src={video.poster} alt={`Video ${video.id}`} />
60+
) : (
61+
<PlaceholderVideo />
62+
)}
63+
</ThumbnailContainer>
64+
);
7865

7966
const Video = ({
8067
video,

0 commit comments

Comments
 (0)