diff --git a/src/components/LeetCodeDifficulty.astro b/src/components/LeetCodeDifficulty.astro index 73f9e4fd..71a71287 100644 --- a/src/components/LeetCodeDifficulty.astro +++ b/src/components/LeetCodeDifficulty.astro @@ -1,9 +1,9 @@ --- import type { HTMLAttributes } from 'astro/types' -import kebabCase from 'lodash.kebabcase' export interface Props extends HTMLAttributes<'a' | 'span'> { tag?: string + href?: string difficulty: string } @@ -13,7 +13,7 @@ const Tag = tag const tagProps: Record = {} if (tag === 'a') { - tagProps.href = `/difficulties/${kebabCase(difficulty)}` + tagProps.href = props.href! } const difficultyStyleMap: Record = { @@ -40,7 +40,7 @@ const getDifficultyCssClass: (difficulty: string) => string = ( props.class, ]} > - {difficulty} + diff --git a/src/components/post/PostList.astro b/src/components/post/PostList.astro index 85999ff2..b235f03b 100644 --- a/src/components/post/PostList.astro +++ b/src/components/post/PostList.astro @@ -11,5 +11,13 @@ const { posts = [] } = Astro.props ---
- {posts.map((p) => )} + { + posts.map((p) => ( + + )) + }
diff --git a/src/pages/difficulties/[slug].astro b/src/pages/difficulties/[slug].astro index 01d4240f..97087162 100644 --- a/src/pages/difficulties/[slug].astro +++ b/src/pages/difficulties/[slug].astro @@ -44,7 +44,9 @@ const { title, description, author } = siteConfig

Posts by difficulty: - + + {difficulty} +

diff --git a/src/pages/index.astro b/src/pages/index.astro index 32617b04..70dd89d0 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -19,9 +19,15 @@ const posts = await getCollection('leetcode-solutions') >
- - - + + Easy + + + Medium + + + Hard +