mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 03:32:51 +02:00
✨ feat: add pinned icon for post list
This commit is contained in:
parent
5cf09194d8
commit
594172c183
9 changed files with 165 additions and 145 deletions
|
@ -11,12 +11,13 @@ type Post = CollectionEntry<'posts'> & {
|
|||
}
|
||||
}
|
||||
|
||||
const { posts, lang } = Astro.props
|
||||
const { posts, lang, pinned = false } = Astro.props
|
||||
const isTag = isTagPage(Astro.url.pathname)
|
||||
|
||||
export interface Props {
|
||||
posts: Post[]
|
||||
lang?: string
|
||||
pinned?: boolean
|
||||
}
|
||||
|
||||
function getPostPath(post: Post) {
|
||||
|
@ -45,6 +46,19 @@ function getPostPath(post: Post) {
|
|||
>
|
||||
{post.data.title}
|
||||
</a>
|
||||
|
||||
{/* pinned icon */}
|
||||
{pinned && (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
aria-hidden="true"
|
||||
class="ml-1 inline-block aspect-square w-3.7 shrink-0 translate-y--0.45 lg:(ml-2 w-4 translate-y--0.55)"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M16.5 23.6c.6-6.1 1.1-8.6 7.2-15.5L15.9.4C9 6.5 6.5 7 .4 7.5l7.4 7.4-6.4 7 .7.7 7-6.4zm-.8-21.3 6 6c-5 6.1-5.7 8.1-6.2 12.2L3.4 8.5C7.5 8 9.5 7.3 15.6 2.3Z" />
|
||||
</svg>
|
||||
)}
|
||||
</h3>
|
||||
|
||||
{/* mobile post time */}
|
||||
|
|
|
@ -39,7 +39,7 @@ const postsByYear = await getPostsByYear(lang)
|
|||
{pinnedPosts.length > 0 && (
|
||||
<section class="mb-7.5">
|
||||
<div class="uno-decorative-line"></div>
|
||||
<PostList posts={pinnedPosts} lang={lang} />
|
||||
<PostList posts={pinnedPosts} lang={lang} pinned={true} />
|
||||
</section>
|
||||
)}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue