Skip to content

Commit

Permalink
WSTEAM1-1567: Change padding for large breakpoint AND Add 16px after …
Browse files Browse the repository at this point in the history
…Live label (#12295)

* WSTEAM1-1567: Change padding for large breakpoint

* WSTEAM1-1567: Add styles

* WSTEAM1-1567: Add 16px spacing

* WSTEAM1-1567: Update

* WSTEAM1-1567: Update
  • Loading branch information
shayneahchoon authored Jan 22, 2025
1 parent 81f36a7 commit 97de1df
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 263 deletions.
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 @@ -27,6 +26,7 @@ export default {
}),
mediaButton: () =>
css({
width: '100%',
position: 'relative',
padding: 0,
}),
Expand Down
2 changes: 0 additions & 2 deletions src/app/components/MaskedImage/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export default {
insetInlineEnd: 0,
},
}),

linearGradientLtr: ({ mq }: Theme) =>
css({
[mq.GROUP_4_MIN_WIDTH]: {
Expand All @@ -140,7 +139,6 @@ export default {
270deg, ${extraWideMask})`, // 270deg for LTR
},
}),

linearGradientRtl: ({ 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
37 changes: 21 additions & 16 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 @@ -48,18 +49,20 @@ const Header = ({
<div css={styles.backgroundColor} />
</div>
<div css={styles.contentContainer}>
{isHeaderImage ? (
<MaskedImage
imageUrl={imageUrl}
imageUrlTemplate={imageUrlTemplate}
imageWidth={imageWidth}
/>
) : null}
<div css={[isMediaOpen && styles.hideMaskedImage]}>
{isHeaderImage ? (
<MaskedImage
imageUrl={imageUrl}
imageUrlTemplate={imageUrlTemplate}
imageWidth={imageWidth}
/>
) : null}
</div>
<div
css={[
isHeaderImage && styles.textContainerWithImage,
!isHeaderImage && styles.textContainerWithoutImage,
isMediaOpen && styles.textContainerMediaOpen,
isWithImageLayout && styles.textContainerWithImage,
!isWithImageLayout && styles.textContainerWithoutImage,
mediaCollections && styles.fixedHeight,
]}
>
<Heading
Expand All @@ -70,7 +73,7 @@ const Header = ({
css={styles.heading}
>
{showLiveLabel ? (
<LiveLabelHeader isHeaderImage={isHeaderImage}>
<LiveLabelHeader isHeaderImage={isWithImageLayout}>
{Title}
</LiveLabelHeader>
) : (
Expand All @@ -83,20 +86,22 @@ const Header = ({
css={[
styles.description,
showLiveLabel &&
!isHeaderImage &&
!isWithImageLayout &&
styles.layoutWithLiveLabelNoImage,
]}
>
{description}
</Text>
)}
{mediaCollections && (
</div>
{mediaCollections && (
<div css={[styles.liveMedia, isMediaOpen && styles.liveMediaOpen]}>
<LiveHeaderMedia
mediaCollection={mediaCollections}
clickCallback={watchVideoClickHandler}
/>
)}
</div>
</div>
)}
</div>
</div>
);
Expand Down
28 changes: 26 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 @@ -17,6 +17,12 @@ export default {
outline: 'none',
},
}),
hideMaskedImage: ({ mq }: Theme) =>
css({
[mq.GROUP_4_MIN_WIDTH]: {
opacity: 0,
},
}),
backgroundContainer: () =>
css({
position: 'absolute',
Expand All @@ -42,12 +48,31 @@ export default {
width: '100%',
},
}),
textContainerMediaOpen: ({ mq }: Theme) =>
liveMedia: ({ 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 +82,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

0 comments on commit 97de1df

Please sign in to comment.