diff --git a/components/PostCard.tsx b/components/PostCard.tsx index 6b9b379..ee0be50 100644 --- a/components/PostCard.tsx +++ b/components/PostCard.tsx @@ -12,7 +12,11 @@ interface PostCardProps { export const PostCard: React.FC = ({ post }) => { return (
- +
{post.mainImage ? ( diff --git a/pages/blog/[slug].tsx b/pages/blog/[slug].tsx index 5bcba17..7618610 100644 --- a/pages/blog/[slug].tsx +++ b/pages/blog/[slug].tsx @@ -2,7 +2,8 @@ import { PortableText } from "@portabletext/react"; import type { GetStaticProps, InferGetStaticPropsType } from "next"; import Image from "next/image"; import { useLiveQuery } from "next-sanity/preview"; - +import urlBuilder from "@sanity/image-url"; +import { getImageDimensions } from "@sanity/asset-utils"; import { readToken } from "../../lib/sanity.api"; import { getClient } from "@lib/sanity.client"; import { urlForImage } from "@lib/sanity.image"; @@ -17,6 +18,7 @@ import React from "react"; import clock from "../../public/images/blog-page/clock.svg"; import person from "../../public/images/blog-page/person.svg"; import { formatDate } from "utils/index"; +import { SanityImageSource } from "@sanity/image-url/lib/types/types"; interface Query { [key: string]: string; @@ -46,6 +48,20 @@ export const getStaticProps: GetStaticProps< }; }; +// Barebones lazy-loaded image component +const SampleImageComponent = ({ value }: { value: any }) => { + const { width, height } = getImageDimensions(value); + return ( + + ); +}; + export default function ProjectSlugRoute( props: InferGetStaticPropsType ) { @@ -85,7 +101,14 @@ export default function ProjectSlugRoute(
- +
diff --git a/styles/components/blog-post-list.scss b/styles/components/blog-post-list.scss index c229d9d..453e66f 100644 --- a/styles/components/blog-post-list.scss +++ b/styles/components/blog-post-list.scss @@ -6,6 +6,9 @@ width: 100%; gap: 16px; + .post-link { + text-decoration: none; + } .post { border-radius: 12px; display: flex; @@ -34,7 +37,6 @@ } .text { padding: 16px; - .title { font-size: 1.2em; margin-bottom: 12px; @@ -45,7 +47,7 @@ flex-direction: row; gap: 4px; align-items: center; - font-size: 0.7em; + font-size: 1em; } .summary { margin-top: 8px; diff --git a/styles/pages/blog-page.scss b/styles/pages/blog-page.scss index a87836d..1145a0f 100644 --- a/styles/pages/blog-page.scss +++ b/styles/pages/blog-page.scss @@ -76,3 +76,7 @@ font-size: 18px; } } + +.post__image { + margin: 0.5em; +}