diff --git a/content/collections/posts.ts b/content/collections/posts.ts index 4c61098c..9ba3ed31 100644 --- a/content/collections/posts.ts +++ b/content/collections/posts.ts @@ -16,6 +16,7 @@ export const posts = defineCollection({ .transform(data => data.split(',').map(tag => tag.trim())), status: s.enum(['published', 'draft', 'planned']).default('draft'), test: s.boolean().default(false), + pinned: s.boolean().default(false), metadata: s.metadata(), toc: s.toc(), content: s.mdx(), diff --git "a/content/posts/exerc\303\255cios-gti-1\302\272-p---programa\303\247\303\243o-estruturada/exerc\303\255cios-gti-1\302\272-p---programa\303\247\303\243o-estruturada.mdx" "b/content/posts/exerc\303\255cios-gti-1\302\272-p---programa\303\247\303\243o-estruturada/exerc\303\255cios-gti-1\302\272-p---programa\303\247\303\243o-estruturada.mdx" index bb115c44..8a47c8f8 100644 --- "a/content/posts/exerc\303\255cios-gti-1\302\272-p---programa\303\247\303\243o-estruturada/exerc\303\255cios-gti-1\302\272-p---programa\303\247\303\243o-estruturada.mdx" +++ "b/content/posts/exerc\303\255cios-gti-1\302\272-p---programa\303\247\303\243o-estruturada/exerc\303\255cios-gti-1\302\272-p---programa\303\247\303\243o-estruturada.mdx" @@ -5,6 +5,7 @@ description: 'Exercícios das aulas de Programação Estruturada, do curso GTI n category: 'Notes' tags: 'fapam,gti,exercícios,curso,faculdade,university,programming,visualg,portugol' status: 'published' +pinned: true --- Esta é a lista de exercícios da matéria de **Programação Estruturada**, do curso de **Gestão de TI**, feito na [FAPAM - Faculdade de Pará de Minas](https://fapam.edu.br). diff --git a/src/components/post-list/index.tsx b/src/components/post-list/index.tsx index a0f8706e..8eaa33a9 100644 --- a/src/components/post-list/index.tsx +++ b/src/components/post-list/index.tsx @@ -3,6 +3,7 @@ import { getSortedPosts } from '~/lib/get-sorted-posts' import { categorizePostsByYear } from './categorize-posts-by-year' import { PostLink } from './post-link' +import { PushPin } from '@phosphor-icons/react/dist/ssr' interface Props { posts: Post[] @@ -16,13 +17,32 @@ export function PostList({ posts, separateByYear = false }: Props) { const testPosts = posts.filter(post => post.test) if (separateByYear) { - const postsByYear = categorizePostsByYear([ - ...publishedPosts, - ...draftPosts - ]) + const pinnedPosts = [...publishedPosts, ...draftPosts].filter( + post => post.pinned + ) + + const unpinnedPosts = [...publishedPosts, ...draftPosts].filter( + post => !post.pinned + ) + + const postsByYear = categorizePostsByYear(unpinnedPosts) return (
+ {pinnedPosts.length > 0 && ( +
+

+ Pinned + +

+
+ {pinnedPosts.map((post, key) => ( + + ))} +
+
+ )} + {postsByYear.map(postsOfYear => (