diff --git a/src/assets/scss/_styles.scss b/src/assets/scss/_styles.scss index 004d79d2..5c185f2a 100644 --- a/src/assets/scss/_styles.scss +++ b/src/assets/scss/_styles.scss @@ -13,8 +13,7 @@ a { } .badge-default { - @extend %badge; - @apply bg-style-primary text-style-primary-inverted; + @apply text-style-secondary border-b-2 border-dotted border-b-style-primary; } .badge-outline { diff --git a/src/pages/tags/[slug].astro b/src/pages/tags/[slug].astro new file mode 100644 index 00000000..f68f0826 --- /dev/null +++ b/src/pages/tags/[slug].astro @@ -0,0 +1,55 @@ +--- +import { getCollection } from 'astro:content' +import kebabCase from 'lodash.kebabcase' + +import LeetCodeDifficulty from '@/components/LeetCodeDifficulty.astro' +import PostList from '@/components/post/PostList.astro' +import siteConfig from '@/configs/site' +import AppLayout from '@/layouts/AppLayout.astro' + +export async function getStaticPaths() { + const allTags = new Set() + const allPosts = await getCollection( + 'leetcode-solutions', + ({ data }) => data.tags?.length > 0 + ) + allPosts.forEach((post) => + post.data.tags?.forEach((t: string) => allTags.add(t)) + ) + + return Array.from(allTags).map((tag) => { + const slug = kebabCase(tag) + const filteredPosts = allPosts.filter((post) => + post.data.tags?.includes(tag) + ) + + return { + params: { slug }, + props: { + posts: filteredPosts, + tag, + }, + } + }) +} + +const { tag, posts } = Astro.props +const { title, description, author } = siteConfig +--- + + +
+
+

+ Posts by tag: + {tag} +

+
+ +
+