Skip to content

Commit

Permalink
fix(tiles): fix content tile body property
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgraeme committed Nov 21, 2024
1 parent 343bc5e commit d53df6a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
13 changes: 6 additions & 7 deletions lib/components/atoms/BaseTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,13 @@ const BaseTileHeader: FC<{ children?: ReactNode }> = ({ children }) => {

const BaseTileMedia: FC<ImagePropsNoSource> = (props) => {
const tile = useTileContext();
const { artworkUrl, title, description } =
tile.configuration as ContentTileConfig;
const { artworkUrl, title, body } = tile.configuration as ContentTileConfig;
const { isHalfSize } = useTileSize(tile);

if (!artworkUrl) return null;

const hasTitle = !!title;
const hasDescription = !!description;
const hasDescription = !!body;

return (
<ProgressiveImage
Expand Down Expand Up @@ -205,14 +204,14 @@ const BaseTileTitle: FC = () => {

const BaseTileBody: FC = (props) => {
const tile = useTileContext();
const { description, artworkUrl } = tile.configuration as ContentTileConfig;
const { body, artworkUrl } = tile.configuration as ContentTileConfig;
const { isHalfSize } = useTileSize(tile);

if ((isHalfSize && artworkUrl) || !description) return null;
if ((isHalfSize && artworkUrl) || !body) return null;

return (
<Text variant="body" {...props} accessibilityLabel={description}>
{description}
<Text variant="body" {...props} accessibilityLabel={body}>
{body}
</Text>
);
};
Expand Down
13 changes: 6 additions & 7 deletions lib/components/organisms/ContentTile/ContentTile.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ FullSizeImageAndText.args = {
priority: 1,
configuration: {
title: 'Welcome Nick!',
description: 'Lorem ipsum dolor sit amet',
body: 'Lorem ipsum dolor sit amet',
artworkUrl:
'https://images.pexels.com/photos/1362534/pexels-photo-1362534.jpeg',
},
Expand Down Expand Up @@ -63,7 +63,7 @@ FullSizeTextOnly.args = {
priority: 1,
configuration: {
title: 'Welcome Nick!',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
},
},
};
Expand All @@ -79,8 +79,7 @@ FullSizeTextOnlyLongBody.args = {
priority: 1,
configuration: {
title: 'Welcome Nick!',
description:
'Lorem ipsum dolor, sit amet consectetur adipisicing elit. Molestias sequi non accusamus veniam iste? Aut assumenda explicabo, beatae, vero illum, saepe perspiciatis soluta tempora consequuntur ipsa voluptates. Placeat, libero! Omnis!',
body: 'Lorem ipsum dolor, sit amet consectetur adipisicing elit. Molestias sequi non accusamus veniam iste? Aut assumenda explicabo, beatae, vero illum, saepe perspiciatis soluta tempora consequuntur ipsa voluptates. Placeat, libero! Omnis!',
},
},
};
Expand Down Expand Up @@ -114,7 +113,7 @@ HalfSizeTextOnly.args = {
priority: 1,
configuration: {
title: 'Welcome Nick!',
description: 'Lorem ipsum dolor sit amet',
body: 'Lorem ipsum dolor sit amet',
},
},
};
Expand All @@ -131,7 +130,7 @@ HalfSizeTextOnlyWithLink.args = {
priority: 1,
configuration: {
title: 'Welcome Nick!',
description: 'Lorem ipsum dolor sit amet',
body: 'Lorem ipsum dolor sit amet',
ctaLink: 'https://www.google.com',
ctaLinkTarget: CTALinkTarget.sameWindow,
},
Expand All @@ -150,7 +149,7 @@ FullSizeWithLink.args = {
priority: 1,
configuration: {
title: 'Welcome Nick!',
description: 'Click here to learn more',
body: 'Click here to learn more',
artworkUrl:
'https://images.pexels.com/photos/1362534/pexels-photo-1362534.jpeg',
ctaLink: 'https://www.google.com',
Expand Down
2 changes: 1 addition & 1 deletion lib/types/tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class PointsTileConfig {

export class ContentTileConfig {
title?: string | null;
description?: string | null;
body?: string | null;
artworkUrl?: string | null;
ctaLinkTarget?: CTALinkTarget;
ctaLink?: string | null;
Expand Down

0 comments on commit d53df6a

Please sign in to comment.