Skip to content

Commit

Permalink
Merge pull request #135 from prgrms-fe-devcourse/120-feature/ptrailer…
Browse files Browse the repository at this point in the history
…-component

120 feature/ptrailer component
  • Loading branch information
thsk3 authored Oct 2, 2024
2 parents 21c92ef + c87f59e commit de566d0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
19 changes: 19 additions & 0 deletions src/components/PTrailer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { PTrailerVideo } from '@/components/PTrailerVideo';
import { PTrailerDesc } from '@/components/PTrailerDesc';
import * as S from './styles';

interface PTrailerProps {
postSrc: string;
vId: string;
vTitle: string;
width?: string;
}

export const PTrailer = ({ postSrc, vId, vTitle, width = '100%' }: PTrailerProps) => {
return (
<S.PTrailer width={width}>
<PTrailerVideo vId={vId} />
<PTrailerDesc src={postSrc} vTitle={vTitle} />
</S.PTrailer>
);
};
7 changes: 7 additions & 0 deletions src/components/PTrailer/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { styled } from 'styled-components';

export const PTrailer = styled.div<{ width: string }>`
width: ${({ width }) => width};
border-radius: 1rem;
overflow: hidden;
`;
6 changes: 3 additions & 3 deletions src/components/PTrailerDesc/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { P16 } from '@/components/Text';

interface PTrailerDescProps {
src: string;
videoTitle: string;
vTitle: string;
width?: string;
}

export const PTrailerDesc = ({ src, videoTitle, width = '100%' }: PTrailerDescProps) => {
export const PTrailerDesc = ({ src, vTitle, width = '100%' }: PTrailerDescProps) => {
return (
<S.PTrailerDesc width={width}>
<Poster src={src} width="50px"></Poster>
<P16>{videoTitle}</P16>
<P16>{vTitle}</P16>
</S.PTrailerDesc>
);
};
2 changes: 1 addition & 1 deletion src/components/PTrailerDesc/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const PTrailerDesc = styled.div<{ width: string }>`
align-items: center;
padding: 1rem;
border: 1px solid ${({ theme }) => theme.colors.gray};
border-radius: 1rem;
border-radius: 0 0 1rem 1rem;
& > div {
border-radius: 0.5rem;
Expand Down
6 changes: 3 additions & 3 deletions src/components/PTrailerVideo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as S from './styles';
interface PTrailerVideoProps {
src: string;
vId: string;
width?: string;
}
export const PTrailerVideo = ({ src, width = '100%' }: PTrailerVideoProps) => {
export const PTrailerVideo = ({ vId, width = '100%' }: PTrailerVideoProps) => {
return (
<S.PTrailerVideo width={width}>
<iframe src={`https://www.youtube.com/embed/${src}`} />
<iframe src={`https://www.youtube.com/embed/${vId}`} />
</S.PTrailerVideo>
);
};

0 comments on commit de566d0

Please sign in to comment.