Featured Blog Post List
Installation
Add the following Soul components
The featured-blog-post-list component uses the button, blog-post-card, streamable, blog-post-card, cursor-pagination, blog-post-list, breadcrumbs and section-layout components. Make sure you have added them to your project.
Copy and paste the following code into your project
sections/featured-blog-post-list/index.tsx
import { Streamable } from '@/vibes/soul/lib/streamable';import { type BlogPost } from '@/vibes/soul/primitives/blog-post-card';import { CursorPagination, CursorPaginationInfo } from '@/vibes/soul/primitives/cursor-pagination';import { BlogPostList } from '@/vibes/soul/sections/blog-post-list';import { type Breadcrumb, Breadcrumbs } from '@/vibes/soul/sections/breadcrumbs';import { SectionLayout } from '@/vibes/soul/sections/section-layout';export interface FeaturedBlogPostListProps { title: string; description?: string | null; blogPosts: Streamable<BlogPost[]>; paginationInfo?: Streamable<CursorPaginationInfo>; breadcrumbs?: Streamable<Breadcrumb[]>; emptyStateSubtitle?: Streamable<string>; emptyStateTitle?: Streamable<string>; placeholderCount?: number;}/** * This component supports various CSS variables for theming. Here's a comprehensive list, along * with their default values: * * ```css * :root { * --featured-blog-post-list-font-family: var(--font-family-body); * --featured-blog-post-list-title-font-family: var(--font-family-body); * --featured-blog-post-list-title: hsl(var(--foreground)); * --featured-blog-post-list-description: hsl(var(--contrast-500)); * } * ``` */export function FeaturedBlogPostList({ title, description, blogPosts, paginationInfo, breadcrumbs, emptyStateSubtitle, emptyStateTitle, placeholderCount,}: FeaturedBlogPostListProps) { return ( <SectionLayout> {breadcrumbs && <Breadcrumbs breadcrumbs={breadcrumbs} />} <div className="pt-6"> <header className="font-[family-name:var(--featured-blog-post-list-font-family,var(--font-family-body))]"> <h1 className="mb-3 font-[family-name:var(--featured-blog-post-list-title-font-family,var(--font-family-heading))] text-4xl font-medium leading-none text-[var(--featured-blog-post-list-title,hsl(var(--foreground)))] @xl:text-5xl @4xl:text-6xl"> {title} </h1> {description != null && description !== '' && ( <p className="max-w-lg text-lg text-[var(--featured-blog-post-list-description,hsl(var(--contrast-500)))]"> {description} </p> )} </header> <div className="group/blog-post-list"> <BlogPostList blogPosts={blogPosts} className="mb-8 mt-8 @4xl:mb-10 @4xl:mt-10" emptyStateSubtitle={emptyStateSubtitle} emptyStateTitle={emptyStateTitle} placeholderCount={placeholderCount} /> </div> {paginationInfo && <CursorPagination info={paginationInfo} />} </div> </SectionLayout> );}
Usage
import { FeaturedBlogPostList } from '@/vibes/soul/sections/featured-blog-post-list';function Usage() { return ( <FeaturedBlogPostList blogPosts={posts} breadcrumbs={[ { id: '1', label: 'Home', href: '#', }, { id: '2', label: 'Blog', href: '#', }, ]} description="Expert Tips & Inspiration for Every Outdoor Lover" emptyStateSubtitle="Check back later for more content" emptyStateTitle="No blog posts found" paginationInfo={{ startCursor: '1', endCursor: '5', }} placeholderCount={6} title="Plant Life" /> );}const posts = [ { id: '5', title: 'A Guide to Low-Light Houseplants', content: 'Not all plants need bright sunlight to thrive. This guide highlights the best low-light houseplants, perfect for those darker corners of your home or office that need a touch of green.', image: { src: 'https://rstr.in/monogram/vibes/T7CeSkvi11I/OrJN5KVj7I1', alt: 'Low-Light Houseplants', }, date: '2024-07-20', href: '#', author: 'Author Name', },];
API Reference
FeaturedBlogPostListProps
Prop | Type | Default |
---|---|---|
className | string | |
title | string | |
description | string | null | |
blogPosts* | ||
paginationInfo | ||
breadcrumbs | ||
emptyStateSubtitle | Streamable <string> | |
emptyStateTitle | Streamable <string> | |
placeholderCount | number |
BlogPost
Prop | Type | Default |
---|---|---|
title* | string | |
author | string | null | |
content* | string | |
date* | string | |
image | {src: string; alt: string; } | null | |
href* | string |
CursorPaginationInfo
Prop | Type | Default |
---|---|---|
startCursorParamName | string | |
startCursor* | string | null | |
endCursorParamName | string | |
endCursor* | string | null |
Breadcrumb
Prop | Type | Default |
---|---|---|
label | string | |
href | string |
CSS Variables
This component supports various CSS variables for theming. Here's a comprehensive list.
:root { --featured-blog-post-list-font-family: var(--font-family-body); --featured-blog-post-list-title-font-family: var(--font-family-body); --featured-blog-post-list-title: hsl(var(--foreground)); --featured-blog-post-list-description: hsl(var(--contrast-500)); --featured-blog-post-list-font-family: var(--font-family-body); --featured-blog-post-list-title-font-family: var(--font-family-body); --featured-blog-post-list-title: hsl(var(--foreground)); --featured-blog-post-list-description: hsl(var(--contrast-500));}