Skip to content
Merged
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
14 changes: 3 additions & 11 deletions dotcom-rendering/src/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,17 @@ type Props = {
alt: string;
shape?: AvatarShape;
imageSize?: MediaSizeType;
isInAllBoostsTest?: boolean;
};

const decideImageWidths = (
imageSize: MediaSizeType,
isInAllBoostsTest = false,
): [ImageWidthType, ...ImageWidthType[]] => {
switch (imageSize) {
case 'small':
return [
{
breakpoint: breakpoints.mobile,
width: isInAllBoostsTest ? 150 : 80,
width: 80,
aspectRatio: '1:1',
},
];
Expand Down Expand Up @@ -144,15 +142,9 @@ const defaultImageSizes: [ImageWidthType, ...ImageWidthType[]] = [
{ breakpoint: breakpoints.tablet, width: 140 },
];

export const Avatar = ({
src,
alt,
shape = 'round',
imageSize,
isInAllBoostsTest,
}: Props) => {
export const Avatar = ({ src, alt, shape = 'round', imageSize }: Props) => {
const imageWidths = imageSize
? decideImageWidths(imageSize, isInAllBoostsTest)
? decideImageWidths(imageSize)
: defaultImageSizes;

const sources = generateSources(getSourceImageUrl(src), imageWidths);
Expand Down
19 changes: 8 additions & 11 deletions dotcom-rendering/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ export type Props = {
trailTextSize?: TrailTextSize;
/** A kicker image is seperate to the main media and renders as part of the kicker */
showKickerImage?: boolean;
isInAllBoostsTest?: boolean;
fixImageWidth?: boolean;
/** Determines if the headline should be positioned within the content or outside the content */
headlinePosition?: 'inner' | 'outer';
Expand Down Expand Up @@ -401,7 +400,6 @@ export const Card = ({
trailTextSize,
showKickerImage = false,
fixImageWidth,
isInAllBoostsTest = false,
headlinePosition = 'inner',
showLabsRedesign = false,
}: Props) => {
Expand Down Expand Up @@ -595,12 +593,18 @@ export const Card = ({
const mediaFixedSizeOptions = (): MediaFixedSizeOptions => {
if (isSmallCard) {
return {
mobile: isInAllBoostsTest ? undefined : 'tiny',
mobile: 'tiny',
tablet: 'small',
desktop: 'small',
};
}
if (isFlexibleContainer) return { mobile: 'small' };

if (isFlexibleContainer) {
return {
mobile: 'small',
};
}

return { mobile: 'medium' };
};

Expand Down Expand Up @@ -939,15 +943,13 @@ export const Card = ({
imagePositionOnMobile={mediaPositionOnMobile}
isBetaContainer={isBetaContainer}
isFlexibleContainer={isFlexibleContainer}
isInAllBoostsTest={isInAllBoostsTest}
>
<Avatar
src={media.avatarUrl}
alt={byline ?? ''}
imageSize={
isBetaContainer ? mediaSize : undefined
}
isInAllBoostsTest={isInAllBoostsTest}
/>
</AvatarContainer>
)}
Expand Down Expand Up @@ -1071,9 +1073,6 @@ export const Card = ({
!isMoreGalleriesOnwardContent
}
aspectRatio={aspectRatio}
isInAllBoostsTest={
isInAllBoostsTest
}
/>
</div>
)}
Expand All @@ -1091,7 +1090,6 @@ export const Card = ({
!isMoreGalleriesOnwardContent
}
aspectRatio={aspectRatio}
isInAllBoostsTest={isInAllBoostsTest}
/>
{isVideoMainMedia && mainMedia.duration > 0 && (
<div
Expand Down Expand Up @@ -1141,7 +1139,6 @@ export const Card = ({
alt={media.trailImage.altText}
loading={imageLoading}
aspectRatio={aspectRatio}
isInAllBoostsTest={isInAllBoostsTest}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ type Props = {
imagePositionOnMobile: MediaPositionType;
isBetaContainer: boolean;
isFlexibleContainer: boolean;
isInAllBoostsTest?: boolean;
};

const sideMarginStyles = css`
Expand All @@ -32,7 +31,6 @@ const sizingStyles = (
isFlexibleContainer: boolean,
isVerticalOnDesktop: boolean,
isVerticalOnMobile: boolean,
isInAllBoostsTest = false,
) => {
if (!isBetaContainer) {
switch (imageSize) {
Expand Down Expand Up @@ -83,26 +81,6 @@ const sizingStyles = (

switch (imageSize) {
case 'small':
if (isInAllBoostsTest) {
return isFlexibleContainer
? css`
width: 90px;
height: 90px;
${until.tablet} {
height: 150px;
width: 150px;
}
`
: css`
width: 80px;
height: 80px;
${until.tablet} {
height: 150px;
width: 150px;
}
`;
}

return isFlexibleContainer
? css`
width: 90px;
Expand Down Expand Up @@ -159,7 +137,6 @@ export const AvatarContainer = ({
imagePositionOnMobile,
isBetaContainer,
isFlexibleContainer,
isInAllBoostsTest,
}: Props) => {
const isVerticalOnDesktop =
imagePositionOnDesktop === 'top' || imagePositionOnDesktop === 'bottom';
Expand All @@ -178,7 +155,6 @@ export const AvatarContainer = ({
isFlexibleContainer,
isVerticalOnDesktop,
isVerticalOnMobile,
isInAllBoostsTest,
),
]}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,12 @@ const fixMediaWidth = ({
tablet,
desktop,
}: MediaFixedSizeOptions) => css`
${until.tablet} {
${mobile !== undefined && fixMediaWidthStyles(mediaFixedSize[mobile])}
}
${mobile &&
css`
${until.tablet} {
${fixMediaWidthStyles(mediaFixedSize[mobile])}
}
`}
${tablet &&
css`
${between.tablet.and.desktop} {
Expand Down
7 changes: 2 additions & 5 deletions dotcom-rendering/src/components/CardPicture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export type Props = {
isCircular?: boolean;
aspectRatio?: AspectRatio;
mobileAspectRatio?: AspectRatio;
isInAllBoostsTest?: boolean;
};

/**
Expand All @@ -30,7 +29,6 @@ export type Props = {
const decideImageWidths = (
imageSize: MediaSizeType,
aspectRatio: AspectRatio,
isInAllBoostsTest: boolean,
): [ImageWidthType, ...ImageWidthType[]] => {
switch (imageSize) {
// @TODO missing image size option
Expand All @@ -56,7 +54,7 @@ const decideImageWidths = (
return [
{
breakpoint: breakpoints.mobile,
width: isInAllBoostsTest ? 465 : 120,
width: 120,
aspectRatio,
},
{ breakpoint: breakpoints.tablet, width: 160, aspectRatio },
Expand Down Expand Up @@ -216,15 +214,14 @@ export const CardPicture = ({
isCircular,
aspectRatio = '5:3',
mobileAspectRatio,
isInAllBoostsTest = false,
}: Props) => {
if (mainImage === '') {
return null;
}

const sources = generateSources(
mainImage,
decideImageWidths(imageSize, aspectRatio, isInAllBoostsTest),
decideImageWidths(imageSize, aspectRatio),
);

const fallbackSource = getFallbackSource(sources);
Expand Down
37 changes: 2 additions & 35 deletions dotcom-rendering/src/components/DecideContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type Props = {
sectionId: string;
frontId?: string;
collectionId: number;
isInAllBoostsTest?: boolean;
containerLevel?: DCRContainerLevel;
/** Feature flag for the labs redesign work */
showLabsRedesign?: boolean;
Expand All @@ -64,7 +63,6 @@ export const DecideContainer = ({
sectionId,
frontId,
collectionId,
isInAllBoostsTest,
containerLevel,
showLabsRedesign = false,
}: Props) => {
Expand Down Expand Up @@ -248,7 +246,6 @@ export const DecideContainer = ({
absoluteServerTimes={absoluteServerTimes}
imageLoading={imageLoading}
aspectRatio={aspectRatio}
isInAllBoostsTest={!!isInAllBoostsTest}
collectionId={collectionId}
showLabsRedesign={!!showLabsRedesign}
/>
Expand All @@ -263,25 +260,12 @@ export const DecideContainer = ({
imageLoading={imageLoading}
aspectRatio={aspectRatio}
containerLevel={containerLevel}
isInAllBoostsTest={!!isInAllBoostsTest}
collectionId={collectionId}
showLabsRedesign={!!showLabsRedesign}
/>
);
case 'scrollable/small':
return isInAllBoostsTest ? (
<ScrollableSmall
trails={trails}
imageLoading={imageLoading}
containerPalette={containerPalette}
showAge={showAge}
absoluteServerTimes={absoluteServerTimes}
aspectRatio={aspectRatio}
isInAllBoostsTest={true}
sectionId={sectionId}
showLabsRedesign={!!showLabsRedesign}
/>
) : (
return (
<Island priority="feature" defer={{ until: 'visible' }}>
<ScrollableSmall
trails={trails}
Expand All @@ -290,27 +274,13 @@ export const DecideContainer = ({
showAge={showAge}
absoluteServerTimes={absoluteServerTimes}
aspectRatio={aspectRatio}
isInAllBoostsTest={false}
sectionId={sectionId}
showLabsRedesign={!!showLabsRedesign}
/>
</Island>
);
case 'scrollable/medium':
return isInAllBoostsTest ? (
<ScrollableMedium
trails={trails}
imageLoading={imageLoading}
containerPalette={containerPalette}
showAge={showAge}
absoluteServerTimes={absoluteServerTimes}
aspectRatio={aspectRatio}
sectionId={sectionId}
showLabsRedesign={!!showLabsRedesign}
containerLevel={containerLevel}
isInAllBoostsTest={true}
/>
) : (
return (
<Island priority="feature" defer={{ until: 'visible' }}>
<ScrollableMedium
trails={trails}
Expand All @@ -321,8 +291,6 @@ export const DecideContainer = ({
aspectRatio={aspectRatio}
sectionId={sectionId}
showLabsRedesign={!!showLabsRedesign}
containerLevel={containerLevel}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional to remove containerLevel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isInAllBoostsTest={isInAllBoostsTest}
/>
</Island>
);
Expand All @@ -336,7 +304,6 @@ export const DecideContainer = ({
imageLoading={imageLoading}
aspectRatio={aspectRatio}
showLabsRedesign={!!showLabsRedesign}
isInAllBoostsTest={isInAllBoostsTest}
/>
);
case 'scrollable/feature':
Expand Down
Loading
Loading