diff --git a/packages/astro-ghostcms-theme-default/src/components/AuthorDetailCard.astro b/packages/astro-ghostcms-theme-default/src/components/AuthorDetailCard.astro new file mode 100644 index 00000000..e4808957 --- /dev/null +++ b/packages/astro-ghostcms-theme-default/src/components/AuthorDetailCard.astro @@ -0,0 +1,97 @@ +--- +export type Props = { + name: string, + image?: string | null, + count: number, + bio: string | null, + location: string | null, + website: string | null, + twitter: string | null, + facebook: string | null +}; + +const { + name, image, bio, location, website, twitter, facebook, count +} = Astro.props as Props; +--- + + + { image ? : ( + + + + + + + + )} + + {name} + + {bio ? bio : count > 0? count + " Posts" : "No Posts"} + + + {location && ( + + 📍 {location} + + )} + + + {website && (Website)} + {twitter && (Twitter)} + {facebook && (Facebook)} + + + + + diff --git a/packages/astro-ghostcms-theme-default/src/routes/author/[slug].astro b/packages/astro-ghostcms-theme-default/src/routes/author/[slug].astro index 9231a1f4..9eb79ee5 100644 --- a/packages/astro-ghostcms-theme-default/src/routes/author/[slug].astro +++ b/packages/astro-ghostcms-theme-default/src/routes/author/[slug].astro @@ -2,6 +2,7 @@ import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro'; import DefaultPageLayout from "../../layouts/default.astro"; import PostPreviewList from "../../components/PostPreviewList.astro"; +import AuthorDetailCard from '../../components/AuthorDetailCard.astro'; import { getAllPosts, getAllAuthors, getSettings, twitter, facebook, invariant } from "@matthiesenxyz/astro-ghostcms/api"; export async function getStaticPaths() { @@ -39,82 +40,7 @@ const description = `All of the articles we've posted and linked so far under th settings={settings} > - - - - {author.profile_image ? ( - - ) : ( - - - - - - - - )} - {author.name} - - {author.bio - ? author.bio - : author.count?.posts || 0 > 0 - ? `${author.count?.posts} Posts` - : "No posts"} - - - - {author.location && ( - 📍 {author.location} - )} - - {author.website && ( - - - {author.website} - - - )} - {author.twitter && ( - - - {author.twitter} - - - )} - {author.facebook && ( - - - {author.facebook} - - - )} - - - - - - + +
- {author.bio - ? author.bio - : author.count?.posts || 0 > 0 - ? `${author.count?.posts} Posts` - : "No posts"} -