From c126331c167e4ba9a24837a6b230b2e757df1f33 Mon Sep 17 00:00:00 2001 From: Daniel Vu Date: Tue, 27 Sep 2022 21:29:43 -0500 Subject: [PATCH] Add blog description --- blog/schemas/post.js | 5 ++++ src/components/ProseableText.jsx | 6 +++-- src/components/pages/blog/BlogPostListing.tsx | 23 +++++++++++-------- src/pages/blog/index.tsx | 20 +++++++++++++--- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/blog/schemas/post.js b/blog/schemas/post.js index 522d2bd..f6795d1 100644 --- a/blog/schemas/post.js +++ b/blog/schemas/post.js @@ -17,6 +17,11 @@ export default { maxLength: 96, }, }, + { + name: 'description', + title: 'Description', + type: 'string', + }, { name: 'author', title: 'Author', diff --git a/src/components/ProseableText.jsx b/src/components/ProseableText.jsx index 30c6fb4..fff2433 100644 --- a/src/components/ProseableText.jsx +++ b/src/components/ProseableText.jsx @@ -4,7 +4,7 @@ */ import { PortableText } from '@portabletext/react'; -import Img from 'next/image'; +import Image from 'next/image'; import { useNextSanityImage } from 'next-sanity-image'; import React, { useMemo } from 'react'; @@ -13,7 +13,9 @@ import { getClient } from '../lib/sanity'; const ImageComponent = ({ value }) => { const imageProps = useNextSanityImage(getClient(false), value); - return ; + console.log(imageProps); + + return ; }; const components = { diff --git a/src/components/pages/blog/BlogPostListing.tsx b/src/components/pages/blog/BlogPostListing.tsx index 38b568b..27a04b5 100644 --- a/src/components/pages/blog/BlogPostListing.tsx +++ b/src/components/pages/blog/BlogPostListing.tsx @@ -11,6 +11,7 @@ export interface Post { slug: string; mainImage: any; title: string; + description: string; author: Author; publishedAt: string; } @@ -38,21 +39,23 @@ const BlogPostListing = (props: BlogPostListingProps) => { className="flex flex-col overflow-hidden rounded-lg shadow-lg" >
- Blog Image + + Blog Image +

{post.title}

-

Sample description

+

{post.description}

diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx index 01b25a5..5d7e945 100644 --- a/src/pages/blog/index.tsx +++ b/src/pages/blog/index.tsx @@ -1,3 +1,4 @@ +import Link from 'next/link'; import { useRouter } from 'next/router'; import { groq } from 'next-sanity'; import { ReactNode } from 'react'; @@ -10,6 +11,7 @@ const query = groq` *[_type == "post"] | order(publishedAt desc) { _id, title, + description, "slug": slug.current, mainImage, publishedAt, @@ -35,11 +37,23 @@ const Posts = (props: any) => { } return ( -
+
-

- Latest from Blog +

+ The Latest from{' '} + + Planner +

+

+ We are always learning and exploring new ideas. We try to share our + experiences through these blogs, and{' '} + + + we would love to hear from you! + + +