--- export interface Props { items: any[]; showCount?: boolean; pageInfo?: { hasNextPage: boolean; endCursor: string | null; }; loadMoreConfig?: { type: 'latest' | 'category' | 'author' | 'tag'; slug?: string; first?: number; }; } const { items = [], showCount = false, pageInfo = { hasNextPage: false, endCursor: null }, loadMoreConfig = { type: 'latest', first: 11 } } = Astro.props; function extractColorClass(colorString: string): string { if (!colorString) return 'bg-blue'; if (colorString.includes('фон меню:')) { const parts = colorString.split(':'); const color = parts[1]?.trim(); const validColors = [ 'black', 'yellow', 'blue', 'green', 'red', 'orange', 'gray', 'indigo', 'purple', 'pink', 'teal', 'cyan', 'white', 'gray-dark', 'light', 'dark' ]; if (color && validColors.includes(color)) { return `bg-${color}`; } } if (colorString.startsWith('bg-')) { return colorString; } const simpleColor = colorString.toLowerCase(); switch(simpleColor) { case 'black': case 'yellow': case 'blue': case 'green': case 'red': case 'orange': case 'gray': case 'indigo': case 'purple': case 'pink': case 'teal': case 'cyan': case 'white': case 'dark': case 'light': return `bg-${simpleColor}`; case 'gray-dark': return 'bg-gray-dark'; default: return 'bg-blue'; } } function getCoauthorsNames(coauthors: any[]): string { if (!coauthors || coauthors.length === 0) return ''; return coauthors .map((coauthor: any) => coauthor?.node?.name || coauthor?.name) .filter(Boolean) .join(' '); } // ✅ ИСПРАВЛЕННАЯ функция для определения больших карточек // Большие карточки на индексах: 8, 19, 30, 41, 52... // Формула: (index - 8) % 11 === 0 function shouldBeLarge(index: number): boolean { if (index < 8) return false; return (index - 8) % 11 === 0; } ---

{showCount && items.length > 0 && ( ({items.length}) )}

{items.map((item, index) => { const postUrl = item.uri || `/blog/${item.databaseId}`; const postDate = new Date(item.date); const coauthors = item.coauthors || []; const coauthorsNames = getCoauthorsNames(coauthors); const rawColor = item.categories?.nodes?.[0]?.color || ''; const categoryBgClass = extractColorClass(rawColor); // ✅ ИСПРАВЛЕННАЯ логика const isLarge = shouldBeLarge(index); const largePosition = isLarge ? 'first' : ''; return ( ); })}
{pageInfo.hasNextPage && (
)}