diff --git a/src/components/ContentGrid.astro b/src/components/ContentGrid.astro index b453d25..1d3f9ab 100644 --- a/src/components/ContentGrid.astro +++ b/src/components/ContentGrid.astro @@ -11,7 +11,8 @@ export interface Props { hasNextPage: boolean; endCursor: string | null; }; - perLoad?: number; + perLoad?: number; // Больше не используется, но оставляем для обратной совместимости + gridColumns?: 3 | 4; } const { @@ -20,13 +21,15 @@ const { type = 'latest', slug = '', pageInfo = { hasNextPage: false, endCursor: null }, - perLoad = 11 + perLoad = 11, // Игнорируется + gridColumns = 4 } = Astro.props; +// Конфиг без perLoad, так как будем вычислять на клиенте const loadMoreConfig = { type, slug, - perLoad + gridColumns }; function getCoauthorsNames(coauthors: any[]): string { @@ -35,17 +38,22 @@ function getCoauthorsNames(coauthors: any[]): string { return coauthors .map((coauthor: any) => { const name = coauthor?.node?.name || coauthor?.name; - const nickname = coauthor?.node?.nickname || coauthor?.nickname; - - return name; // Возвращаем только имя, ссылки будут в шаблоне + return name; }) .filter(Boolean) .join(', '); } -function shouldBeLarge(index: number): boolean { - if (index < 8) return false; - return (index - 8) % 11 === 0; +function shouldBeLarge(index: number, columns: number): boolean { + if (columns === 4) { + // Паттерн для 4 колонок: большие на позициях 8, 19, 30, 41... + if (index < 8) return false; + return (index - 8) % 11 === 0; + } else { + // Паттерн для 3 колонок: большие на позициях 6, 14, 22, 30... + if (index < 6) return false; + return (index - 6) % 8 === 0; + } } --- @@ -56,16 +64,21 @@ function shouldBeLarge(index: number): boolean { )} -