Skip to content

Commit

Permalink
Merge pull request #4313 from luke-h1/fix/hotfix-tags
Browse files Browse the repository at this point in the history
fix(frontend): hotfix tags
  • Loading branch information
luke-h1 authored Jan 14, 2024
2 parents d79bbf5 + 80ef553 commit 4e497ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ const PostPage = async ({ params }: Props) => {
</Text>
),
},
// todo: clean up the below - hotfix for potentially undefined tags
{
...(post.tags && {
title: 'Tags',
description: (
title: post.tags && post.tags.length > 0 ? 'Tags' : undefined,
description:
post.tags && post.tags.length > 0 ? (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{post.tags.length > 0
{post.tags && post.tags.length > 0
? post.tags.slice(0, 3).map(tag => (
<Link
href={`/blog/tags/${tag.slug.current}`}
Expand All @@ -90,8 +91,7 @@ const PostPage = async ({ params }: Props) => {
))
: null}
</>
),
}),
) : undefined,
},
]}
/>
Expand Down
12 changes: 7 additions & 5 deletions src/components/Meta/Meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { ReactNode, CSSProperties } from 'react';
import SocialShare from '../SocialShare/SocialShare';
import * as styles from './Meta.css';

export interface MetaItem {
title: ReactNode;
description: ReactNode;
}

interface Props {
items: {
title: ReactNode;
description: ReactNode;
}[];
items?: MetaItem[];
}

const Meta = ({ items }: Props) => {
Expand All @@ -15,7 +17,7 @@ const Meta = ({ items }: Props) => {
className={styles.root}
style={
{
'--length': items.length,
'--length': items?.length,
} as CSSProperties
}
>
Expand Down

0 comments on commit 4e497ce

Please sign in to comment.