Skip to content

Commit

Permalink
Pass gallery count to card (#12996)
Browse files Browse the repository at this point in the history
* Add gallery count to model and pass through to card

* log out gallery count for linter

* Disable lint check
  • Loading branch information
abeddow91 authored Dec 12, 2024
1 parent 4212c19 commit 014a4c7
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dotcom-rendering/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export type Props = {
trailTextColour?: string;
/** The square podcast series image, if it exists for a card */
podcastImage?: PodcastSeriesImage;
galleryCount?: number;
};

const starWrapper = (cardHasImage: boolean) => css`
Expand Down Expand Up @@ -340,6 +341,8 @@ export const Card = ({
trailTextSize,
trailTextColour,
podcastImage,
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added in preparation for UI changes to display gallery count
galleryCount,
}: Props) => {
const hasSublinks = supportingContent && supportingContent.length > 0;
const sublinkPosition = decideSublinkPosition(
Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/src/components/FrontCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const FrontCard = (props: Props) => {
slideshowImages: trail.slideshowImages,
showLivePlayable: trail.showLivePlayable,
showMainVideo: trail.showMainVideo,
galleryCount: trail.galleryCount,
};

return Card({ ...defaultProps, ...cardProps });
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/model/enhanceCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ export const enhanceCards = (
const podcastImage = getPodcastSeriesImage(faciaCard);

const isContributorTagPage = !!pageId && pageId.startsWith('profile/');

return {
format,
dataLinkName,
Expand Down Expand Up @@ -329,5 +328,6 @@ export const enhanceCards = (
},
}),
podcastImage,
galleryCount: faciaCard.card.galleryCount,
};
});
9 changes: 9 additions & 0 deletions dotcom-rendering/src/model/front-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,9 @@
},
"isLive": {
"type": "boolean"
},
"galleryCount": {
"type": "number"
}
},
"required": [
Expand Down Expand Up @@ -1779,6 +1782,9 @@
},
"isLive": {
"type": "boolean"
},
"galleryCount": {
"type": "number"
}
},
"required": [
Expand Down Expand Up @@ -2527,6 +2533,9 @@
},
"isLive": {
"type": "boolean"
},
"galleryCount": {
"type": "number"
}
},
"required": [
Expand Down
3 changes: 3 additions & 0 deletions dotcom-rendering/src/model/tag-page-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@
},
"isLive": {
"type": "boolean"
},
"galleryCount": {
"type": "number"
}
},
"required": [
Expand Down
2 changes: 2 additions & 0 deletions dotcom-rendering/src/types/front.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export type FEFrontCard = {
shortUrl: string;
group: string;
isLive: boolean;
galleryCount?: number;
};
discussion: {
isCommentable: boolean;
Expand Down Expand Up @@ -348,6 +349,7 @@ export type DCRFrontCard = {
slideshowImages?: DCRSlideshowImage[];
showMainVideo?: boolean;
podcastImageSrc?: string;
galleryCount?: number;
};

export type DCRSlideshowImage = {
Expand Down

0 comments on commit 014a4c7

Please sign in to comment.