File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,12 +4,12 @@ import type { CollectionEntry } from "astro:content";
44import Datetime from " ./Datetime.astro" ;
55
66export interface Props {
7+ variant? : " h2" | " h3" ;
78 href? : string ;
89 frontmatter: CollectionEntry <" blog" >[" data" ];
9- secHeading? : boolean ;
1010}
1111
12- const { href, frontmatter, secHeading = true } = Astro .props ;
12+ const { href, frontmatter, variant = " h2 " } = Astro .props ;
1313
1414const { title, pubDatetime, modDatetime, description } = frontmatter ;
1515
@@ -25,13 +25,13 @@ const headerProps = {
2525 class =" inline-block text-lg font-medium text-accent decoration-dashed underline-offset-4 focus-visible:no-underline focus-visible:underline-offset-0"
2626 >
2727 {
28- secHeading ? (
28+ variant === " h2 " ? (
2929 <h2 { ... headerProps } >{ title } </h2 >
3030 ) : (
3131 <h3 { ... headerProps } >{ title } </h3 >
3232 )
3333 }
3434 </a >
35- <Datetime pubDatetime = { pubDatetime } modDatetime = { modDatetime } />
35+ <Datetime {pubDatetime } {modDatetime } />
3636 <p >{ description } </p >
3737</li >
Original file line number Diff line number Diff line change @@ -77,11 +77,7 @@ const recentPosts = sortedPosts.filter(({ data }) => !data.featured);
7777 <h2 class = " text-2xl font-semibold tracking-wide" >Featured</h2 >
7878 <ul >
7979 { featuredPosts .map (({ data , id }) => (
80- <Card
81- href = { ` /posts/${id }/ ` }
82- frontmatter = { data }
83- secHeading = { false }
84- />
80+ <Card href = { ` /posts/${id }/ ` } frontmatter = { data } variant = " h3" />
8581 ))}
8682 </ul >
8783 </section >
@@ -101,7 +97,7 @@ const recentPosts = sortedPosts.filter(({ data }) => !data.featured);
10197 <Card
10298 href = { ` /posts/${id }/ ` }
10399 frontmatter = { data }
104- secHeading = { false }
100+ variant = " h3 "
105101 />
106102 )
107103 )}
You can’t perform that action at this time.
0 commit comments