feat(quote-carousel): add QuoteCarouselBlock component and related types
- Introduced a new QuoteCarouselBlock component for displaying rotating quotes. - Added QuoteCarouselBlockData interface to define the structure of the quote carousel data. - Updated existing components and types to integrate the new quote carousel functionality. - Enhanced blog-utils to support filtering posts by tags more effectively. - Made various UI improvements in the Footer and PostCard components for better user experience.
This commit is contained in:
+14
-12
@@ -378,7 +378,19 @@ export async function resolvePostOverviewBlocks(
|
||||
if (!Array.isArray(content)) continue;
|
||||
for (const item of content) {
|
||||
if (!isPostOverviewBlock(item)) continue;
|
||||
if (item.allPosts) {
|
||||
const rawFilter = item.filterByTag ?? [];
|
||||
const tagSlugs = Array.isArray(rawFilter)
|
||||
? rawFilter
|
||||
.map((t) =>
|
||||
typeof t === "string"
|
||||
? t
|
||||
: ((t as { _slug?: string })?._slug ?? ""),
|
||||
)
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
const hasExplicitPosts = Array.isArray(item.posts) && item.posts.length > 0;
|
||||
const useAllPosts = item.allPosts || (tagSlugs.length > 0 && !hasExplicitPosts);
|
||||
if (useAllPosts) {
|
||||
if (allPosts === null)
|
||||
allPosts = await getPosts({
|
||||
_sort: "created",
|
||||
@@ -386,21 +398,11 @@ export async function resolvePostOverviewBlocks(
|
||||
resolve: "all",
|
||||
});
|
||||
let list = filterHiddenPosts(sortPostsByDate(allPosts));
|
||||
const rawFilter = item.filterByTag ?? [];
|
||||
const tagSlugs = Array.isArray(rawFilter)
|
||||
? rawFilter
|
||||
.map((t) =>
|
||||
typeof t === "string"
|
||||
? t
|
||||
: ((t as { _slug?: string })?._slug ?? ""),
|
||||
)
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
if (tagSlugs.length) list = filterPostsByTagSlugs(list, tagSlugs);
|
||||
const limit =
|
||||
typeof item.numberItems === "number" ? item.numberItems : 9999;
|
||||
item.postsResolved = list.slice(0, limit);
|
||||
} else if (Array.isArray(item.posts) && item.posts.length > 0) {
|
||||
} else if (hasExplicitPosts && Array.isArray(item.posts)) {
|
||||
const first = item.posts[0];
|
||||
const isResolved =
|
||||
typeof first === "object" &&
|
||||
|
||||
Reference in New Issue
Block a user