d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
100 lines
2.5 KiB
TypeScript
100 lines
2.5 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { ChevronRight } from 'lucide-react'
|
|
import { serializeJsonLd } from '@/lib/json-ld'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
interface FAQItem {
|
|
question: string
|
|
answer: string
|
|
}
|
|
|
|
interface FAQProps {
|
|
items: FAQItem[]
|
|
title?: string
|
|
}
|
|
|
|
function FAQItemRow({
|
|
item,
|
|
isOpen,
|
|
onToggle,
|
|
}: {
|
|
item: FAQItem
|
|
isOpen: boolean
|
|
onToggle: () => void
|
|
}) {
|
|
return (
|
|
<div>
|
|
<button
|
|
type='button'
|
|
onClick={onToggle}
|
|
aria-expanded={isOpen}
|
|
className='flex w-full cursor-pointer items-center gap-3 px-4 py-2.5 text-left font-[470] text-[0.875rem] text-[var(--text-body)] transition-colors hover:bg-[var(--surface-3)]'
|
|
>
|
|
<ChevronRight
|
|
className={cn(
|
|
'size-[14px] shrink-0 text-[var(--text-icon)] transition-transform duration-200',
|
|
isOpen && 'rotate-90'
|
|
)}
|
|
/>
|
|
{item.question}
|
|
</button>
|
|
<div
|
|
className='grid transition-[grid-template-rows,opacity] duration-200 ease-in-out'
|
|
style={{
|
|
gridTemplateRows: isOpen ? '1fr' : '0fr',
|
|
opacity: isOpen ? 1 : 0,
|
|
}}
|
|
>
|
|
<div className='overflow-hidden'>
|
|
<div className='px-4 pt-2 pb-2.5 pl-11 text-[0.875rem] text-[var(--text-secondary)] leading-relaxed'>
|
|
{item.answer}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export function FAQ({ items, title = 'Common Questions' }: FAQProps) {
|
|
const [openIndex, setOpenIndex] = useState<number | null>(null)
|
|
|
|
const faqSchema = {
|
|
'@context': 'https://schema.org',
|
|
'@type': 'FAQPage',
|
|
mainEntity: items.map((item) => ({
|
|
'@type': 'Question',
|
|
name: item.question,
|
|
acceptedAnswer: {
|
|
'@type': 'Answer',
|
|
text: item.answer,
|
|
},
|
|
})),
|
|
}
|
|
|
|
return (
|
|
<div className='mt-12'>
|
|
<script
|
|
type='application/ld+json'
|
|
dangerouslySetInnerHTML={{ __html: serializeJsonLd(faqSchema) }}
|
|
/>
|
|
<h2 className='mb-4 font-[500] text-xl'>{title}</h2>
|
|
<div className='border-[var(--border)] border-t border-b'>
|
|
{items.map((item, index) => (
|
|
<div
|
|
key={item.question}
|
|
className={cn(index !== items.length - 1 && 'border-[var(--border)] border-b')}
|
|
>
|
|
<FAQItemRow
|
|
item={item}
|
|
isOpen={openIndex === index}
|
|
onToggle={() => setOpenIndex(openIndex === index ? null : index)}
|
|
/>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|