Files
aragrp/components/blog-collapse-section.tsx
ar.badieiandCursor c2376b3b9e
Build & Push Docker Image / build (push) Has been cancelled
feat: redesign landing page with brand system and section blocks
Refresh the homepage around new hero/services/roadmap sections, shared design tokens, and updated brand assets.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 17:00:55 +03:30

63 lines
2.1 KiB
TypeScript

"use client";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
import type { CollapseBlockPayload } from "@/lib/blog-blocks";
import { type } from "@/lib/typography";
import { cn } from "@/lib/utils";
import { Icon } from "@iconify/react";
interface BlogCollapseSectionProps {
section: CollapseBlockPayload;
/** Optional prefix for accordion item ids (e.g. for multiple sections on one page). */
idPrefix?: string;
}
export function BlogCollapseSection({
section,
idPrefix = "collapse",
}: BlogCollapseSectionProps) {
if (!section.items.length) return null;
return (
<div className="my-8 space-y-4 border rounded-blog p-6">
{section.title ? (
<h2 className={cn(type.h2, "!mt-0 mb-4 scroll-mt-24")}>
{section.title}
</h2>
) : null}
<Accordion type="single" collapsible className="w-full gap-1">
{section.items.map((item, i) => (
<AccordionItem
key={i}
value={`${idPrefix}-${i}`}
className="border-none !m-0 hover:bg-muted has-[[data-state=open]]:bg-muted px-4 rounded-md"
>
<AccordionTrigger className={cn(type["list-title"], "group/trigger cursor-pointer py-4 text-right hover:no-underline [&>svg]:shrink-0")}>
<span className="flex gap-1 items-center">
<Icon
icon="lucide:circle-small"
className="size-5 group-data-[state=open]/trigger:hidden"
/>
<Icon
icon="lucide:dot"
className="size-5 hidden group-data-[state=open]/trigger:inline-block"
/>
{item.question}
</span>
</AccordionTrigger>
<AccordionContent className={cn(type.body, "text-muted-foreground [&_a]:text-primary [&_a]:underline hover:[&_a]:no-underline")}>
<div dangerouslySetInnerHTML={{ __html: item.answer }} />
</AccordionContent>
</AccordionItem>
))}
</Accordion>
</div>
);
}