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-1567: Change padding for large breakpoint AND Add 16px after Live label #12295

Open
wants to merge 5 commits into
base: latest
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/app/components/LiveHeaderMedia/index.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import pixelsToRem from '#app/utilities/pixelsToRem';
import { css, Theme } from '@emotion/react';

export default {
componentContainer: ({ spacings }: Theme) =>
componentContainer: () =>
css({
width: '100%',
marginTop: `${spacings.DOUBLE}rem`,
[`.${NO_JS_CLASSNAME} &`]: {
display: 'none',
},
Expand All @@ -30,6 +29,7 @@ export default {
}),
mediaButton: () =>
css({
width: '100%',
position: 'relative',
padding: 0,
}),
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/MaskedImage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ const MaskedImage = ({
imageWidth,
altText = '',
showPlaceholder = true,
hideImage = false,
}: {
imageUrl: string;
imageUrlTemplate: string;
imageWidth: number;
altText?: string;
showPlaceholder?: boolean;
hideImage?: boolean;
}) => {
const { dir } = useContext(ServiceContext);
const { isAmp } = useContext(RequestContext);
Expand All @@ -44,6 +46,7 @@ const MaskedImage = ({
css={[
styles.maskedImageWrapper,
isRtl ? styles.linearGradientRtl : styles.linearGradientLtr,
hideImage && styles.hideImage,
]}
>
<Image
Expand Down
7 changes: 6 additions & 1 deletion src/app/components/MaskedImage/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ export default {
insetInlineEnd: 0,
},
}),

hideImage: ({ mq }: Theme) =>
css({
[mq.GROUP_4_MIN_WIDTH]: {
opacity: 0,
},
}),
linearGradientLtr: ({ mq }: Theme) =>
css({
[mq.GROUP_4_MIN_WIDTH]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ const styles = {
color: 'canvasText',
},
}),
liveLabelTextWithImage: ({ palette, fontSizes, fontVariants, mq }: Theme) =>
liveLabelTextWithImage: ({
palette,
spacings,
fontSizes,
fontVariants,
mq,
}: Theme) =>
css({
'span:first-of-type': {
color: palette.LIVE_LIGHT,
Expand All @@ -36,6 +42,9 @@ const styles = {
...fontSizes.paragon,
},
},
'span:nth-of-type(3)': {
marginTop: `${spacings.DOUBLE}rem`,
},
}),
liveLabelTextWithoutImage: ({
mq,
Expand Down
26 changes: 17 additions & 9 deletions ws-nextjs-app/pages/[service]/live/[id]/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ const Header = ({
}) => {
const [isMediaOpen, setLiveMediaOpen] = useState(false);
const isHeaderImage = !!imageUrl && !!imageUrlTemplate && !!imageWidth;
const isWithImageLayout = isHeaderImage || !!mediaCollections;

const watchVideoClickHandler = () => {
setLiveMediaOpen(!isMediaOpen);
};

const Title = (
<span
css={isHeaderImage ? styles.titleWithImage : styles.titleWithoutImage}
css={isWithImageLayout ? styles.titleWithImage : styles.titleWithoutImage}
>
{title}
</span>
Expand All @@ -53,13 +54,16 @@ const Header = ({
imageUrl={imageUrl}
imageUrlTemplate={imageUrlTemplate}
imageWidth={imageWidth}
hideImage={isMediaOpen}
/>
) : null}
<div
css={[
isHeaderImage && styles.textContainerWithImage,
!isHeaderImage && styles.textContainerWithoutImage,
isMediaOpen && styles.textContainerMediaOpen,
isWithImageLayout && styles.textContainerWithImage,
!isHeaderImage &&
!mediaCollections &&
styles.textContainerWithoutImage,
mediaCollections && styles.fixedHeight,
]}
>
<Heading
Expand All @@ -70,7 +74,7 @@ const Header = ({
css={styles.heading}
>
{showLiveLabel ? (
<LiveLabelHeader isHeaderImage={isHeaderImage}>
<LiveLabelHeader isHeaderImage={isWithImageLayout}>
{Title}
</LiveLabelHeader>
) : (
Expand All @@ -83,20 +87,24 @@ const Header = ({
css={[
styles.description,
showLiveLabel &&
!isHeaderImage &&
!isWithImageLayout &&
styles.layoutWithLiveLabelNoImage,
]}
>
{description}
</Text>
)}
{mediaCollections && (
</div>
{mediaCollections && (
<div
css={[styles.liveMediaClose, isMediaOpen && styles.liveMediaOpen]}
>
<LiveHeaderMedia
mediaCollection={mediaCollections}
clickCallback={watchVideoClickHandler}
/>
)}
</div>
</div>
)}
</div>
</div>
);
Expand Down
22 changes: 20 additions & 2 deletions ws-nextjs-app/pages/[service]/live/[id]/Header/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,31 @@ export default {
width: '100%',
},
}),
textContainerMediaOpen: ({ mq }: Theme) =>
liveMediaClose: ({ mq, spacings }: Theme) =>
css({
padding: `0rem ${spacings.FULL}rem ${spacings.DOUBLE}rem`,
[mq.GROUP_2_MIN_WIDTH]: {
padding: `0rem ${spacings.DOUBLE}rem ${spacings.DOUBLE}rem`,
},
[mq.GROUP_4_MIN_WIDTH]: {
padding: `${spacings.DOUBLE}rem ${spacings.DOUBLE}rem ${pixelsToRem(40)}rem`,
maxWidth: '50%', // determines width of text overlay.
},
}),
liveMediaOpen: ({ mq }: Theme) =>
css({
[mq.GROUP_4_MIN_WIDTH]: {
maxWidth: '100%',
},
}),
fixedHeight: ({ mq, spacings }: Theme) =>
css({
[mq.GROUP_4_MIN_WIDTH]: {
minHeight: '0',
padding: `${pixelsToRem(40)}rem ${spacings.DOUBLE}rem 0`,
maxWidth: '50%', // determines width of text overlay.
},
}),
textContainerWithoutImage: ({ mq, gridWidths, spacings }: Theme) =>
css({
position: 'relative',
Expand All @@ -57,7 +76,6 @@ export default {
[mq.GROUP_2_MIN_WIDTH]: {
padding: `${spacings.DOUBLE}rem`,
},

[mq.GROUP_4_MIN_WIDTH]: {
paddingTop: `${spacings.TRIPLE}rem`,
paddingBottom: `${spacings.QUADRUPLE}rem`,
Expand Down
Loading