Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
468e738
Add star background styles to star rating component
abeddow91 Dec 16, 2025
351c54e
Add flex to the star rating parent and move key to the star wrapper
abeddow91 Dec 16, 2025
369e578
Add gap sizes dependent on star size
abeddow91 Dec 16, 2025
b3c120b
Fix size of stars and background in determine size
abeddow91 Dec 16, 2025
d5ae0dc
Remove block colour
abeddow91 Dec 16, 2025
39ad7e8
Update palette for new star rating colours
abeddow91 Dec 16, 2025
4cb3e80
Adjust colours for background of stars
abeddow91 Dec 16, 2025
6ded9c6
Add a medium sized star rating
abeddow91 Dec 16, 2025
bda2a04
Remove padding from card so the ratings start left aligned
abeddow91 Dec 16, 2025
8dde2a1
Bump star svg sizes so the path is the correct size
abeddow91 Dec 17, 2025
945073f
Add padding to the top of star rating
abeddow91 Dec 17, 2025
7f83d49
Remove wrapper for highlights card star rating
abeddow91 Dec 17, 2025
80187bc
Remove wrapper for highlights card star rating
abeddow91 Dec 17, 2025
f14e5ce
Remove star rating from image component as the rating should no longe…
abeddow91 Dec 17, 2025
bcff6d7
Add padding top decision to star rating
abeddow91 Dec 17, 2025
95470f5
Move star rating inside headline for article rendering
abeddow91 Dec 17, 2025
a6e3d76
Remove star rating from main media
abeddow91 Dec 17, 2025
83b248e
Add star rating to headline in standard layout
abeddow91 Dec 17, 2025
d4648f8
Remove wrapper for rich link
abeddow91 Dec 17, 2025
47e6952
Set star rating size for scrollable feature and static feature contai…
abeddow91 Dec 17, 2025
2ee565b
Use prop sizing for star rating on cards
abeddow91 Dec 17, 2025
cb325d9
Pass star rating into headline in live layout
abeddow91 Dec 17, 2025
f56a055
Move star rating into headline component in comment layout
abeddow91 Dec 17, 2025
190d2ff
Move star rating into headline component in picture layout
abeddow91 Dec 17, 2025
f50fe1a
Move star rating into headline component in immersive layout
abeddow91 Dec 17, 2025
727d294
Update stories
abeddow91 Dec 17, 2025
0e8ba04
Fix linting issues
abeddow91 Dec 17, 2025
8124b29
Fix linting issues
abeddow91 Dec 17, 2025
31c2a8a
Update schema to include new rating size "medium"
abeddow91 Dec 17, 2025
c066a79
Adjust rich link so that is sits directly below the headline with med…
abeddow91 Dec 17, 2025
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
39 changes: 35 additions & 4 deletions dotcom-rendering/src/components/ArticleHeadline.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { css } from '@emotion/react';
import { isUndefined } from '@guardian/libs';
import {
between,
from,
Expand Down Expand Up @@ -28,10 +29,12 @@ import {
} from '../lib/articleFormat';
import { getZIndex } from '../lib/getZIndex';
import { palette as themePalette } from '../palette';
import type { StarRating as Rating } from '../types/content';
import type { TagType } from '../types/tag';
import { AgeWarning } from './AgeWarning';
import { DesignTag } from './DesignTag';
import { HeadlineByline } from './HeadlineByline';
import { StarRating } from './StarRating/StarRating';

type Props = {
headlineString: string;
Expand All @@ -41,6 +44,7 @@ type Props = {
webPublicationDateDeprecated: string;
hasAvatar?: boolean;
isMatch?: boolean;
starRating?: Rating;
};

const topPadding = css`
Expand Down Expand Up @@ -121,15 +125,13 @@ const headlineFont = (format: ArticleFormat) => {
if (format.design === ArticleDesign.Gallery) {
return css`
${decideMobileHeadlineFont(format)}

${from.desktop} {
${decideHeadlineFont(format)}
}
`;
}
return css`
${decideMobileHeadlineFont(format)}

${from.tablet} {
${decideHeadlineFont(format)}
}
Expand All @@ -138,6 +140,7 @@ const headlineFont = (format: ArticleFormat) => {

const invertedFontLineHeight = css`
line-height: 2.1875rem;

${from.tablet} {
line-height: 2.625rem;
}
Expand All @@ -146,6 +149,7 @@ const invertedFontLineHeight = css`
const labsFont = css`
${textSansBold28};
line-height: 2rem;

${from.tablet} {
${textSansBold34};
line-height: 2.375rem;
Expand All @@ -155,6 +159,7 @@ const labsFont = css`
const labsGalleryFont = css`
${textSansBold34};
line-height: 2.1875rem;

${from.desktop} {
${textSansBold34};
font-size: 50px;
Expand All @@ -166,6 +171,7 @@ const jumboLabsFont = css`
${textSansBold34};
font-size: 3.125rem;
line-height: 3.5rem;

${until.desktop} {
${textSansBold34};
line-height: 2.375rem;
Expand Down Expand Up @@ -203,12 +209,15 @@ const immersiveStyles = css`
min-height: 112px;
padding-bottom: ${space[6]}px;
padding-left: ${space[1]}px;

${from.mobileLandscape} {
padding-left: ${space[3]}px;
}

${from.tablet} {
padding-left: ${space[1]}px;
}

margin-right: ${space[5]}px;
`;

Expand Down Expand Up @@ -242,12 +251,15 @@ const immersiveWrapper = css`
Make sure we vertically align the headline font with the body font
*/
margin-left: 6px;

${from.tablet} {
margin-left: 16px;
}

${from.leftCol} {
margin-left: 25px;
}

/*
We need this grow to ensure the headline fills the main content column
*/
Expand All @@ -257,6 +269,7 @@ const immersiveWrapper = css`
box that extends the black background to the right
*/
z-index: ${getZIndex('articleHeadline')};

${until.mobileLandscape} {
margin-right: 40px;
}
Expand Down Expand Up @@ -352,6 +365,7 @@ const decideBottomPadding = ({
if (format.display === ArticleDisplay.Showcase) {
return css`
padding-bottom: ${space[1]}px;

${from.tablet} {
padding-bottom: ${space[6]}px;
}
Expand All @@ -364,7 +378,8 @@ const decideBottomPadding = ({
case ArticleDesign.Review: {
if (format.display === ArticleDisplay.Showcase) {
return css`
padding-bottom: 28px;
padding-bottom: ${space[5]}px;

${from.tablet} {
padding-bottom: ${space[6]}px;
}
Expand All @@ -384,6 +399,7 @@ const decideBottomPadding = ({
? ''
: css`
padding-bottom: 28px;

${from.tablet} {
padding-bottom: ${space[9]}px;
}
Expand All @@ -396,7 +412,7 @@ const decideBottomPadding = ({
const galleryStyles = css`
${grid.between('grid-start', 'centre-column-end')}

grid-row: 7/9;
grid-row: 7 / 9;
position: relative;

${from.tablet} {
Expand All @@ -413,6 +429,7 @@ export const ArticleHeadline = ({
webPublicationDateDeprecated,
hasAvatar,
isMatch,
starRating,
}: Props) => {
switch (format.display) {
case ArticleDisplay.Immersive: {
Expand Down Expand Up @@ -496,6 +513,13 @@ export const ArticleHeadline = ({
{headlineString}
</span>
</h1>
{!isUndefined(starRating) && (
<StarRating
rating={starRating}
paddingSize={'large'}
size={'large'}
/>
)}
</WithAgeWarning>
);
}
Expand Down Expand Up @@ -572,6 +596,13 @@ export const ArticleHeadline = ({
>
{headlineString}
</h1>
{!isUndefined(starRating) && (
<StarRating
rating={starRating}
paddingSize={'medium'}
size={'large'}
/>
)}
</WithAgeWarning>
</div>
);
Expand Down
59 changes: 20 additions & 39 deletions dotcom-rendering/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { css } from '@emotion/react';
import { isUndefined } from '@guardian/libs';
import {
between,
from,
palette as sourcePalette,
space,
until,
} from '@guardian/source/foundations';
import { between, from, space, until } from '@guardian/source/foundations';
import { Hide, Link, SvgCamera } from '@guardian/source/react-components';
import {
ArticleDesign,
Expand All @@ -22,7 +16,7 @@ import { DISCUSSION_ID_DATA_ATTRIBUTE } from '../../lib/useCommentCount';
import { BETA_CONTAINERS } from '../../model/enhanceCollections';
import { palette } from '../../palette';
import type { Branding } from '../../types/branding';
import type { StarRating as Rating } from '../../types/content';
import type { StarRating as Rating, RatingSizeType } from '../../types/content';
import type {
AspectRatio,
DCRContainerPalette,
Expand Down Expand Up @@ -163,31 +157,9 @@ export type Props = {
/** Determines if the headline should be positioned within the content or outside the content */
headlinePosition?: 'inner' | 'outer';
enableHls?: boolean;
starRatingSize?: RatingSizeType;
};

const starWrapper = (cardHasImage: boolean) => css`
background-color: ${sourcePalette.brandAlt[400]};
color: ${sourcePalette.neutral[0]};
margin-top: ${cardHasImage ? '2' : space[1]}px;
display: inline-block;

${from.tablet} {
margin-top: ${space[1]}px;
}
`;

const StarRatingComponent = ({
rating,
cardHasImage,
}: {
rating: Rating;
cardHasImage: boolean;
}) => (
<div css={starWrapper(cardHasImage)}>
<StarRating rating={rating} size="small" />
</div>
);

const waveformWrapper = (
mediaPositionOnMobile?: MediaPositionType,
mediaPositionOnDesktop?: MediaPositionType,
Expand All @@ -196,13 +168,16 @@ const waveformWrapper = (
left: 0;
right: 0;
bottom: 0;

svg {
display: block;
width: 100%;
height: ${mediaPositionOnMobile === 'top' ? 50 : 29}px;

${from.mobileMedium} {
height: ${mediaPositionOnMobile === 'top' ? 50 : 33}px;
}

${from.tablet} {
height: ${mediaPositionOnDesktop === 'top' ? 50 : 33}px;
}
Expand All @@ -216,12 +191,15 @@ const HorizontalDivider = () => (
border-top: 1px solid ${palette('--card-border-top')};
height: 1px;
width: 50%;

${from.tablet} {
width: 100px;
}

${from.desktop} {
width: 140px;
}

margin-top: ${space[3]}px;
}
`}
Expand All @@ -236,6 +214,7 @@ const podcastImageStyles = (
return css`
width: 69px;
height: 69px;

${from.tablet} {
width: 98px;
height: 98px;
Expand All @@ -249,11 +228,14 @@ const podcastImageStyles = (
return css`
width: 98px;
height: 98px;

${from.tablet} {
width: 120px;
height: 120px;
}

/** The image takes the full height on desktop, so that the waveform sticks to the bottom of the card. */

${from.desktop} {
width: ${isHorizontalOnDesktop ? 'unset' : '120px'};
height: ${isHorizontalOnDesktop ? 'unset' : '120px'};
Expand Down Expand Up @@ -421,6 +403,7 @@ export const Card = ({
headlinePosition = 'inner',
subtitleSize = 'small',
enableHls = false,
starRatingSize = 'small',
}: Props) => {
const hasSublinks = supportingContent && supportingContent.length > 0;
const sublinkPosition = decideSublinkPosition(
Expand Down Expand Up @@ -579,8 +562,8 @@ export const Card = ({

/**
- * Media cards have contrasting background colours. We add additional
* padding to these cards to keep the text readable.
- */
* padding to these cards to keep the text readable.
- */
const isMediaCardOrNewsletter = isMediaCard(format) || isNewsletter;

const showPill = isMediaCardOrNewsletter && !isGallerySecondaryOnward;
Expand Down Expand Up @@ -845,6 +828,7 @@ export const Card = ({
${until.tablet} {
display: none;
}

${from.desktop} {
display: none;
}
Expand Down Expand Up @@ -909,10 +893,7 @@ export const Card = ({
isExternalLink={isExternalLink}
/>
{!isUndefined(starRating) ? (
<StarRatingComponent
rating={starRating}
cardHasImage={!!image}
/>
<StarRating rating={starRating} size="small" />
) : null}
</div>
)}
Expand Down Expand Up @@ -1237,9 +1218,9 @@ export const Card = ({
}
/>
{!isUndefined(starRating) ? (
<StarRatingComponent
<StarRating
rating={starRating}
cardHasImage={!!image}
size={starRatingSize}
/>
) : null}
</HeadlineWrapper>
Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/src/components/FeatureCard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const cardProps: CardProps = {
showClock: false,
imageSize: 'feature',
collectionId: 1,
starRatingSize: 'medium',
};

const aBasicLink = {
Expand Down
Loading
Loading