diff --git a/src/components/Blog/Card/index.tsx b/src/components/Blog/Card/index.tsx index d25cfd703..bc7c24571 100644 --- a/src/components/Blog/Card/index.tsx +++ b/src/components/Blog/Card/index.tsx @@ -1,3 +1,4 @@ +import Image from 'next/image' import Link from 'next/link' import { Box, Typography } from '@mui/material' import css from './styles.module.css' @@ -5,20 +6,27 @@ import blogCss from '../styles.module.css' import { calculateReadingTime } from '@/components/Blog/utils/calculateReadingTime' import Tags from '@/components/Blog/Tags' import CategoryIcon from '@/public/images/Blog/category-icon.svg' +import { isAsset, isEntryTypeTag } from '@/lib/typeGuards' +import { type BlogPostEntry } from '@/components/Blog/Post' -const Card = (props: any) => { +const Card = (props: BlogPostEntry) => { const { slug, title, content, coverImage, tags, category } = props.fields - const image = { - src: coverImage.fields.file.url, - alt: coverImage.fields.title, - } + const tagsList = tags.filter(isEntryTypeTag) return (
- {image.alt} + {isAsset(coverImage) && coverImage.fields.file?.url ? ( + {(coverImage.fields.title + ) : undefined}
@@ -36,7 +44,7 @@ const Card = (props: any) => { - +
diff --git a/src/components/Blog/FeaturedPost/index.tsx b/src/components/Blog/FeaturedPost/index.tsx index 7459ecd1d..c6962ea48 100644 --- a/src/components/Blog/FeaturedPost/index.tsx +++ b/src/components/Blog/FeaturedPost/index.tsx @@ -12,6 +12,8 @@ import CategoryIcon from '@/public/images/Blog/category-icon.svg' const FeaturedPost = (props: BlogPostEntry) => { const { slug, coverImage, category, date, title, excerpt, tags, content } = props.fields + const tagsList = tags.filter(isEntryTypeTag) + return ( @@ -45,7 +47,7 @@ const FeaturedPost = (props: BlogPostEntry) => { {excerpt} - + diff --git a/src/components/Blog/Post/index.tsx b/src/components/Blog/Post/index.tsx index a7c79872b..da612f218 100644 --- a/src/components/Blog/Post/index.tsx +++ b/src/components/Blog/Post/index.tsx @@ -24,6 +24,8 @@ const BlogPost = ({ blogPost }: { blogPost: BlogPostEntry }) => { const { title, excerpt, content, coverImage, authors, tags, category, date, relatedPosts, metaTags } = blogPost.fields const authorsList = authors.filter(isEntryTypeAuthor) + const tagsList = tags.filter(isEntryTypeTag) + const relatedPostsList = relatedPosts?.filter(isEntryTypePost) return ( @@ -51,7 +53,7 @@ const BlogPost = ({ blogPost }: { blogPost: BlogPostEntry }) => { - + @@ -77,7 +79,7 @@ const BlogPost = ({ blogPost }: { blogPost: BlogPostEntry }) => { - + ) diff --git a/src/components/Blog/Tags/index.tsx b/src/components/Blog/Tags/index.tsx index 121e34ad9..0fd50b594 100644 --- a/src/components/Blog/Tags/index.tsx +++ b/src/components/Blog/Tags/index.tsx @@ -8,7 +8,7 @@ const Tags = ({ tags }: { tags: Entry[] }) = return (
- {tags.map((tag: any) => { + {tags.map((tag) => { const { name } = tag.fields return