diff --git a/.gitignore b/.gitignore index 16d54bb..06c1e92 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ pnpm-debug.log* # jetbrains setting folder .idea/ + +*.obsidian/ \ No newline at end of file diff --git a/src/components/ArticleCard.astro b/src/components/ArticleCard.astro new file mode 100644 index 0000000..41ef4d2 --- /dev/null +++ b/src/components/ArticleCard.astro @@ -0,0 +1,244 @@ +--- +import FormattedDate from './FormattedDate.astro'; + +interface Props { + title: string; + description: string; + pubDate: Date; + slug: string; + readingTime: number; + featured?: boolean; +} + +const { title, description, pubDate, slug, readingTime, featured = false } = Astro.props; +const hasContent = Astro.slots.has('default'); +--- + +
+

+ {title} +

+
+ + · + {readingTime} 分钟读完 +
+

{description}

+ {featured && hasContent ? ( + <> +
+
+ +
+
+
+ + + ) : ( + 阅读更多 + )} +
+ +{featured && hasContent && ( + +)} + + diff --git a/src/components/Footer.astro b/src/components/Footer.astro deleted file mode 100644 index 96c2fce..0000000 --- a/src/components/Footer.astro +++ /dev/null @@ -1,62 +0,0 @@ ---- -const today = new Date(); ---- - - - diff --git a/src/components/FormattedDate.astro b/src/components/FormattedDate.astro index 1bcce73..558cc9b 100644 --- a/src/components/FormattedDate.astro +++ b/src/components/FormattedDate.astro @@ -8,9 +8,9 @@ const { date } = Astro.props;