File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed
Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,17 @@ const VideoCard = styled.a`
77` ;
88
99const VideoThumbnailWrapper = styled . div `
10- position: relative;
10+ width: 160px;
11+ height: 90px;
12+ border-radius: 4px;
13+ overflow: hidden;
14+ gap: 6px;
15+ background-color: ${ ( { theme } ) => theme . palette . mobile . grey . g80 } ;
16+ flex-shrink: 0;
17+ display: flex;
18+ align-items: center;
19+ justify-content: center;
20+ border: 1px solid #2e303a;
1121` ;
1222
1323const VideoInfo = styled . div `
@@ -36,6 +46,13 @@ const VideoThumbnail = styled.img`
3646const VideoTitle = styled . p `
3747 ${ ( { theme } ) => theme . typo . sh1 } ;
3848 color: #f6f7ff;
49+ margin: 0;
50+ display: -webkit-box;
51+ -webkit-line-clamp: 2;
52+ -webkit-box-orient: vertical;
53+ overflow: hidden;
54+ text-overflow: ellipsis;
55+ word-break: break-word;
3956` ;
4057
4158export default {
Original file line number Diff line number Diff line change 11import { useYoutubeVideoDuration } from '@boolti/api' ;
22import { formatYoutubeDuration , getYoutubeThumbnailUrl , getYoutubeVideoId } from '~/utils' ;
33import Styled from './VideoCard.styles' ;
4+ import { BooltiDarkIcon , BooltiDarkLogo } from '@boolti/icon' ;
45
56interface VideoCardProps {
67 videoUrl : string ;
@@ -9,12 +10,21 @@ interface VideoCardProps {
910const VideoCard = ( { videoUrl } : VideoCardProps ) => {
1011 const videoId = getYoutubeVideoId ( videoUrl ) as string ;
1112 const { data } = useYoutubeVideoDuration ( videoId ) ;
13+ const thumbnailUrl = videoId ? getYoutubeThumbnailUrl ( videoId ) : null ;
14+
1215 const formattedDuration = formatYoutubeDuration ( data ?. duration ?? null ) ;
1316
1417 return (
1518 < Styled . VideoCard href = { videoUrl } target = "_blank" rel = "noopener noreferrer" >
1619 < Styled . VideoThumbnailWrapper >
17- < Styled . VideoThumbnail src = { getYoutubeThumbnailUrl ( videoId ) } alt = "YouTube video" />
20+ { thumbnailUrl ? (
21+ < Styled . VideoThumbnail src = { thumbnailUrl } alt = "YouTube video" />
22+ ) : (
23+ < >
24+ < BooltiDarkIcon />
25+ < BooltiDarkLogo />
26+ </ >
27+ ) }
1828 </ Styled . VideoThumbnailWrapper >
1929 < Styled . VideoInfo >
2030 < Styled . VideoTitle > { data ?. title ?? '알 수 없는 동영상' } </ Styled . VideoTitle >
Original file line number Diff line number Diff line change @@ -45,6 +45,12 @@ const Title = styled.p`
4545 color: #f6f7ff;
4646 margin: 0;
4747 line-height: 1.4;
48+ display: -webkit-box;
49+ -webkit-line-clamp: 2;
50+ -webkit-box-orient: vertical;
51+ overflow: hidden;
52+ text-overflow: ellipsis;
53+ word-break: break-word;
4854` ;
4955
5056const Duration = styled . p `
You can’t perform that action at this time.
0 commit comments