Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSTEAM1-POC: Style #11778

Draft
wants to merge 1 commit into
base: Transcript-front-end
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/app/legacy/containers/MediaPlayer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '#psammead/gel-foundations/src/spacings';
import styled from '@emotion/styled';
import { GEL_GROUP_4_SCREEN_WIDTH_MIN } from '#psammead/gel-foundations/src/breakpoints';

import { css } from '@emotion/react';
import {
CanonicalMediaPlayer,
AmpMediaPlayer,
Expand Down Expand Up @@ -90,6 +90,12 @@ const MediaPlayerContainer = ({
width: 100%;
`;

const FigureStylesTranscript = ({ palette, isDarkUi }) =>
css({
background: isDarkUi ? palette.GREY_10 : palette.WHITE,
paddingBottom: `0`,
});

const mediaIsValid = available && (clipId || blockId);
if (!mediaIsValid) {
if (isLegacyMedia && available) {
Expand Down Expand Up @@ -154,7 +160,7 @@ const MediaPlayerContainer = ({
embedSource={makeAbsolute(embedSource)}
/>
{showCaption && caption ? (
<Figure>
<Figure css={transcriptBlock && FigureStylesTranscript}>
{mediaPlayer}
{showCaption && caption}
</Figure>
Expand Down
20 changes: 17 additions & 3 deletions src/app/legacy/containers/MediaPlayer/index.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ import { BrowserRouter } from 'react-router-dom';
import { RequestContextProvider } from '#contexts/RequestContext';
import { ToggleContext } from '#contexts/ToggleContext';
import { ARTICLE_PAGE } from '#app/routes/utils/pageTypes';
import { validVideoWithCaptionBlock } from './fixtureData';
import {
validVideoWithCaptionBlock,
validVideoWithCaptionAndTranscriptBlock,
} from './fixtureData';
import MediaPlayerContainer from '.';
import AmpDecorator from '../../../../../.storybook/helpers/ampDecorator';

const Component = ({ service, isAmp = false }) => {
const Component = ({
service,
isAmp = false,
blocks = validVideoWithCaptionBlock,
}) => {
return (
<RequestContextProvider
isAmp={isAmp}
Expand All @@ -29,7 +36,7 @@ const Component = ({ service, isAmp = false }) => {
>
<BrowserRouter>
<MediaPlayerContainer
blocks={validVideoWithCaptionBlock}
blocks={blocks}
assetId="c3wmq4d1y3wo"
assetType="articles"
showPlaceholder
Expand All @@ -47,6 +54,13 @@ export default {
};

export const Amp = (_, globalArgs) => <Component isAmp {...globalArgs} />;
export const CanonicalWithTranscript = () => (
<Component
isAmp
blocks={validVideoWithCaptionAndTranscriptBlock}
/>
);

export const Canonical = Component;

Amp.decorators = [AmpDecorator];
Loading