diff --git a/.deco/blocks/collections%2Fblog%2Fposts%2F377b4d05ae7d.json b/.deco/blocks/collections%2Fblog%2Fposts%2F377b4d05ae7d.json index 26b1266..beac97d 100644 --- a/.deco/blocks/collections%2Fblog%2Fposts%2F377b4d05ae7d.json +++ b/.deco/blocks/collections%2Fblog%2Fposts%2F377b4d05ae7d.json @@ -4,14 +4,6 @@ "post": { "authors": [], "categories": [ - { - "name": "Direitos e Políticas", - "slug": "direitos-e-politicas" - }, - { - "name": "Justiça", - "slug": "justiça" - }, { "name": "Notícias", "slug": "news" diff --git a/.deco/blocks/collections%2Fblog%2Fposts%2F9c87f3b4f229.json b/.deco/blocks/collections%2Fblog%2Fposts%2F9c87f3b4f229.json index ed7e14d..d766cd1 100644 --- a/.deco/blocks/collections%2Fblog%2Fposts%2F9c87f3b4f229.json +++ b/.deco/blocks/collections%2Fblog%2Fposts%2F9c87f3b4f229.json @@ -3,7 +3,12 @@ "__resolveType": "blog/loaders/Blogpost.ts", "post": { "authors": [], - "categories": [], + "categories": [ + { + "name": "Notícias", + "slug": "news" + } + ], "extraProps": [], "title": "Nota da ANTRA sobre a Importância da CEDAW e sua Relevância para a Pauta Trans", "excerpt": "Nota da ANTRA sobre a Importância da CEDAW e sua Relevância para a Pauta Trans", diff --git a/.deco/blocks/pages-Noticias-464054.json b/.deco/blocks/pages-Noticias-464054.json index 75519b2..58d4f35 100644 --- a/.deco/blocks/pages-Noticias-464054.json +++ b/.deco/blocks/pages-Noticias-464054.json @@ -41,9 +41,12 @@ "title": "Todas as notícias", "allNews": { "__resolveType": "blog/loaders/BlogpostList.ts", - "sortBy": "date_desc", "slug": "news", - "count": 1 + "sortBy": "date_desc" + }, + "pagination": { + "page": 1, + "perPage": 5 } }, { diff --git a/islands/all-news.tsx b/islands/all-news.tsx index 419e3e2..69367ec 100644 --- a/islands/all-news.tsx +++ b/islands/all-news.tsx @@ -12,7 +12,7 @@ export interface Info { export interface Props { title: string; info: Info; - allNews?: BlogPostListingPage; + allNews?: BlogPost[] | null; pagination?: { page?: number; perPage?: number; @@ -30,7 +30,6 @@ export default function AllNewsIsland( pagination: { perPage, page: page + 1 }, }, }); - console.log(allNews) const [selectedTags, setSelectedTags] = useState([]); useEffect(() => { diff --git a/islands/featured-news.tsx b/islands/featured-news.tsx index 30db603..3567b25 100644 --- a/islands/featured-news.tsx +++ b/islands/featured-news.tsx @@ -28,8 +28,8 @@ export interface Props { news: News[]; title: string; info: Info; - allNews?: BlogPostListingPage; - pagination?: { + allNews: BlogPost[] | null; + pagination: { page?: number; perPage?: number; }; @@ -41,7 +41,8 @@ export default function FeaturedNewsIsland({ news, title, info, - allNews + allNews, + pagination: { page = 1, perPage = 13 } = {} }: Props) { const [selectedTags, setSelectedTags] = useState([]); @@ -51,14 +52,14 @@ export default function FeaturedNewsIsland({ ); }; - // const filteredNews = - // selectedTags.length === 0 - // ? allNews - // : allNews?.posts?.filter((newsItem) => - // selectedTags.some((tag) => - // newsItem?.posts?.extraProps?.some((item) => item.value.includes(tag)) - // ) - // ); + const filteredNews = + selectedTags.length === 0 + ? allNews + : allNews?.filter((newsItem) => + selectedTags.some((tag) => + newsItem?.extraProps?.some((item) => item.value.includes(tag)) + ) + ); return ( <> @@ -155,7 +156,7 @@ export default function FeaturedNewsIsland({ - + ); } diff --git a/sections/FeaturedNews.tsx b/sections/FeaturedNews.tsx index a04bc21..f3656e7 100644 --- a/sections/FeaturedNews.tsx +++ b/sections/FeaturedNews.tsx @@ -26,10 +26,14 @@ export interface Props { title: string; info: Info; allNews?: BlogPost[] | null; + pagination?: { + page?: number; + perPage?: number; + }; } export default function FeaturedNews( - { tags, mainNews, news, title, info, allNews }: Props, + { tags, mainNews, news, title, info, allNews, pagination }: Props, ) { return ( <> @@ -40,6 +44,7 @@ export default function FeaturedNews( title={title} info={info} allNews={allNews} + pagination={pagination} /> );