--- import Base from '../layouts/Base.astro'; import Navigation from '../components/Navigation.astro'; import Footer from '../components/Footer.astro'; import PageHero from '../components/PageHero.astro'; import BentoGrid from '../components/BentoGrid.astro'; import BentoTile from '../components/BentoTile.astro'; import DecoOrb from '../components/DecoOrb.astro'; import { getCollection } from 'astro:content'; const faqItems = await getCollection('faq'); const categories = ['บริการ', 'ราคา', 'ระยะเวลา', 'AI & เทคนิค', 'หลังการขาย']; // Group FAQ items by category (preserve original order within each category) const groupedFaq = categories .map(cat => ({ category: cat, items: faqItems.filter(f => f.data.category === cat), })) .filter(g => g.items.length > 0); // Split each category's items into chunks of 2 (or 3 for the last chunk if odd count) function chunkItems(arr: T[], size: number): T[][] { const chunks: T[][] = []; for (let i = 0; i < arr.length; i += size) { chunks.push(arr.slice(i, i + size)); } return chunks; } // Pre-compute all FAQ tiles with assigned spans + surfaces for visual rhythm // Rotation: yellow, soft, purple-soft, mint, teal, dark, coral, purple, mint const surfaceRotation = ['yellow', 'soft', 'purple-soft', 'mint', 'teal', 'dark', 'coral', 'purple', 'mint'] as const; // Span strategy for category tile pairs: 7+5, 5+7, 8+4, 4+8, 7+5 ... avoid 6+6 const spanPairs = [[7, 5], [5, 7], [8, 4], [4, 8], [7, 5]] as const; interface FaqTile { category: string; items: typeof faqItems; surface: typeof surfaceRotation[number]; span: 4 | 5 | 7 | 8; tileIndex: number; // 0, 1 within category isFirst: boolean; isLast: boolean; } const faqTiles: FaqTile[] = []; groupedFaq.forEach((group, gIdx) => { const chunks = chunkItems(group.items, 2); const pair = spanPairs[gIdx % spanPairs.length]; chunks.forEach((chunk, cIdx) => { const tileSurface = surfaceRotation[faqTiles.length % surfaceRotation.length]; faqTiles.push({ category: group.category, items: chunk, surface: tileSurface, span: (pair[cIdx] ?? 6) as 4 | 5 | 7 | 8, tileIndex: cIdx, isFirst: cIdx === 0, isLast: cIdx === chunks.length - 1, }); }); }); ---
{faqTiles.map((tile) => (
{tile.items.map((item) => (
{item.data.question} +

{item.data.answer}

))}
))}
โฮสติ้ง โดเมน SSL ใบเสนอราคา ใบกำกับภาษี สัญญา NDA ลิขสิทธิ์งาน ทีมงาน ขนาดทีม ที่ตั้งบริษัท ตัวอย่างงาน ขอดูเว็บจริง นัดคุยนอกสถานที่
ช่องทางติดต่อ

ไม่เจอคำตอบ? ถามตรง ๆ เลย

คนที่อยากคุยเร็ว ๆ แบบเป็นกันเอง

ตอบใน 30 นาที (เวลาทำการ)

ทักเลย →

คนที่อยากคุยยาว ๆ 5–10 นาที ถามตอบสด

จ-ศ 09:00-18:00

โทรเลย →

คนที่อยากส่งรายละเอียดโปรเจกต์ + ไฟล์แนบ

ตอบภายใน 1 วัน

ส่งอีเมล →

พร้อมคุยรายละเอียด?

นัดปรึกษาฟรี 30 นาที ผ่าน Zoom หรือนัดเจอที่ออฟฟิศ (กรุงเทพ/สมุทรสาคร)