From ff1fc96a5cdd1eeb4529087c7d22d72a44eaa649 Mon Sep 17 00:00:00 2001 From: eggy Date: Wed, 10 Aug 2022 16:31:25 -0400 Subject: [PATCH] feat: add tag navigation --- components/BlogStatBox.vue | 12 +- components/PostPreviewCard.vue | 69 ++++++++ components/StoryStatBox.vue | 14 +- components/Tag.vue | 10 +- content/blog/scavenger-hunt.md | 2 + content/stories/a-favour.md | 4 +- content/stories/growing-pains.md | 4 +- .../stories/java.lang.nullpointerexception.md | 2 + data/tagInfo.ts | 31 ++++ nuxt.config.ts | 11 +- package.json | 5 +- pages/blog.vue | 22 ++- pages/stories.vue | 56 +------ pages/tags/blog/[tag].vue | 38 +++++ pages/tags/stories/[tag].vue | 38 +++++ shared/readingTime.ts | 30 ++++ yarn.lock | 152 ++++++++++++------ 17 files changed, 373 insertions(+), 127 deletions(-) create mode 100644 components/PostPreviewCard.vue create mode 100644 data/tagInfo.ts create mode 100644 pages/tags/blog/[tag].vue create mode 100644 pages/tags/stories/[tag].vue create mode 100644 shared/readingTime.ts diff --git a/components/BlogStatBox.vue b/components/BlogStatBox.vue index 3753b0a..b00e554 100644 --- a/components/BlogStatBox.vue +++ b/components/BlogStatBox.vue @@ -2,6 +2,7 @@ import dayjs from "dayjs"; import utc from "dayjs/plugin/utc.js"; import type { BlogParsedContent } from "@/shared/types"; +import { calcReadingTime } from "@/shared/readingTime"; dayjs.extend(utc); @@ -26,33 +27,28 @@ const prettyDate = latestDate.format("DD MMM YYYY"); >

{{ latest.title }}

- {{ prettyDate }} · {{ latest.readingTime.text }} + {{ prettyDate }} · {{ calcReadingTime(latest).minutes }} min read

{{ tag }}
- -

- {{ latest.description }} … -

diff --git a/components/PostPreviewCard.vue b/components/PostPreviewCard.vue new file mode 100644 index 0000000..5accea2 --- /dev/null +++ b/components/PostPreviewCard.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/components/StoryStatBox.vue b/components/StoryStatBox.vue index b8b9e33..1dfb943 100644 --- a/components/StoryStatBox.vue +++ b/components/StoryStatBox.vue @@ -2,6 +2,7 @@ import dayjs from "dayjs"; import utc from "dayjs/plugin/utc.js"; import { type StoryParsedContent } from "@/shared/types"; +import { calcReadingTime } from "@/shared/readingTime"; dayjs.extend(utc); @@ -26,35 +27,28 @@ const prettyDate = latestDate.format("DD MMM YYYY"); >

{{ latest.title }}

- {{ prettyDate }} · {{ latest.readingTime.words }} words + {{ prettyDate }} · {{ calcReadingTime(latest).words.total }} words

{{ tag }}
- -

- {{ latest.description }} ... -

diff --git a/components/Tag.vue b/components/Tag.vue index dbadfb5..e716b09 100644 --- a/components/Tag.vue +++ b/components/Tag.vue @@ -1,11 +1,17 @@