Skip to content

Commit 92fcbe7

Browse files
committed
Youtube feature card overlay should use play icon component
1 parent 86c5bad commit 92fcbe7

File tree

3 files changed

+15
-28
lines changed

3 files changed

+15
-28
lines changed

dotcom-rendering/src/components/Card/components/PlayIcon.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,22 @@ const theme = {
6565
fill: sourcePalette.neutral[100],
6666
} satisfies Partial<ThemeIcon>;
6767

68-
type Props = {
69-
iconSizeOnDesktop: PlayButtonSize;
70-
iconSizeOnMobile: PlayButtonSize;
71-
iconWidth: 'narrow' | 'wide';
72-
};
68+
type Props =
69+
| {
70+
iconWidth: 'wide';
71+
iconSizeOnDesktop: PlayButtonSize;
72+
iconSizeOnMobile: PlayButtonSize;
73+
}
74+
| {
75+
iconWidth: 'narrow';
76+
iconSizeOnDesktop?: never;
77+
iconSizeOnMobile?: never;
78+
};
7379

7480
export const PlayIcon = ({
81+
iconWidth,
7582
iconSizeOnDesktop,
7683
iconSizeOnMobile,
77-
iconWidth,
7884
}: Props) => {
7985
return (
8086
<div

dotcom-rendering/src/components/YoutubeAtom/YoutubeAtomFeatureCardOverlay.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { secondsToDuration } from '../../lib/formatTime';
66
import { palette } from '../../palette';
77
import type { AspectRatio } from '../../types/front';
88
import { CardFooter } from '../Card/components/CardFooter';
9+
import { PlayIcon } from '../Card/components/PlayIcon';
910
import { TrailText } from '../Card/components/TrailText';
1011
import type { ResponsiveFontSize } from '../CardHeadline';
1112
import { CardHeadline } from '../CardHeadline';
@@ -78,24 +79,6 @@ const videoPillStyles = css`
7879
right: ${space[2]}px;
7980
`;
8081

81-
const playIconWidth = 56;
82-
const playIconStyles = css`
83-
position: absolute;
84-
/**
85-
* Subject to change. We will wait to see how fronts editors use the
86-
* headlines and standfirsts before we decide on a final position.
87-
*/
88-
top: 35%;
89-
left: calc(50% - ${playIconWidth / 2}px);
90-
width: ${playIconWidth}px;
91-
height: ${playIconWidth}px;
92-
background-color: ${palette('--feature-card-play-icon-background')};
93-
opacity: 0.7;
94-
border-radius: 50%;
95-
border: 1px solid ${palette('--feature-card-play-icon-border')};
96-
fill: ${palette('--feature-card-play-icon-fill')};
97-
`;
98-
9982
type Props = {
10083
uniqueId: string;
10184
height: number;
@@ -181,9 +164,7 @@ export const YoutubeAtomFeatureCardOverlay = ({
181164
</div>
182165
) : null}
183166
<div className="image-overlay" />
184-
<div className="play-icon" css={[playIconStyles]}>
185-
<SvgMediaControlsPlay />
186-
</div>
167+
<PlayIcon iconWidth="narrow" />
187168
<div css={[textOverlayStyles]}>
188169
{!!kicker && (
189170
<Kicker

dotcom-rendering/src/components/YoutubeAtom/YoutubeAtomOverlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ export const YoutubeAtomOverlay = ({
182182
</div>
183183
) : null}
184184
<PlayIcon
185+
iconWidth="wide"
185186
iconSizeOnDesktop={iconSizeOnDesktop}
186187
iconSizeOnMobile={iconSizeOnMobile}
187-
iconWidth="wide"
188188
/>
189189
{showTextOverlay && (
190190
<div css={textOverlayStyles}>

0 commit comments

Comments
 (0)