|
| 1 | +<script setup lang="ts"> |
| 2 | +import { extractPlainText } from '~/utils/content' |
| 3 | +
|
| 4 | +const { t } = useI18n() |
| 5 | +const { items } = useTeamFaqContent() |
| 6 | +
|
| 7 | +const detailsClass = [ |
| 8 | + 'group rounded-xl border border-neutral-200 dark:border-neutral-800', |
| 9 | + 'bg-white dark:bg-neutral-900/60 px-4 py-3 open:shadow-sm', |
| 10 | + 'transition-shadow' |
| 11 | +].join(' ') |
| 12 | +
|
| 13 | +const summaryClass = [ |
| 14 | + 'flex cursor-pointer list-none items-center justify-between gap-4', |
| 15 | + 'text-base font-semibold text-neutral-900 dark:text-neutral-100', |
| 16 | + 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary rounded-md' |
| 17 | +].join(' ') |
| 18 | +
|
| 19 | +const toggleClass = [ |
| 20 | + 'inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full', |
| 21 | + 'bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-300', |
| 22 | + 'transition-transform group-open:rotate-45' |
| 23 | +].join(' ') |
| 24 | +
|
| 25 | +const proseClass = [ |
| 26 | + 'prose prose-sm md:prose-base prose-neutral dark:prose-invert max-w-none mt-3', 'prose-a:text-primary prose-a:underline-offset-2 prose-a:hover:underline' |
| 27 | +].join(' ') |
| 28 | +
|
| 29 | +// Extra FAQPage schema scoped to the team page; Google currently restricts |
| 30 | +// FAQ rich results to authoritative sources, but other crawlers (Bing, |
| 31 | +// DuckDuckGo, AI assistants) still pick it up. Plain-text answers only, |
| 32 | +// so we strip the MDC AST down. |
| 33 | +useSchemaOrg(() => { |
| 34 | + if (!items.value.length) return [] |
| 35 | + return [ |
| 36 | + { |
| 37 | + '@type': 'FAQPage', |
| 38 | + mainEntity: items.value.map((entry) => ({ |
| 39 | + '@type': 'Question' as const, |
| 40 | + name: entry.question, |
| 41 | + acceptedAnswer: { |
| 42 | + '@type': 'Answer' as const, |
| 43 | + text: extractPlainText(entry.body, 500) |
| 44 | + } |
| 45 | + })) |
| 46 | + } |
| 47 | + ] |
| 48 | +}) |
| 49 | +</script> |
| 50 | + |
| 51 | +<template> |
| 52 | + <section |
| 53 | + v-if="items.length" |
| 54 | + class="mt-12 md:mt-16" |
| 55 | + :aria-labelledby="'team-faq-heading'" |
| 56 | + > |
| 57 | + <header class="mb-6 text-center"> |
| 58 | + <h2 |
| 59 | + id="team-faq-heading" |
| 60 | + class="text-2xl md:text-3xl font-bold tracking-tight text-neutral-900 dark:text-neutral-100" |
| 61 | + > |
| 62 | + {{ t('team.faq.section_title') }} |
| 63 | + </h2> |
| 64 | + <p class="mt-2 text-sm md:text-base text-neutral-600 dark:text-neutral-400"> |
| 65 | + {{ t('team.faq.section_subtitle') }} |
| 66 | + </p> |
| 67 | + </header> |
| 68 | + |
| 69 | + <div class="space-y-3"> |
| 70 | + <details |
| 71 | + v-for="entry in items" |
| 72 | + :key="entry.key" |
| 73 | + :class="detailsClass" |
| 74 | + > |
| 75 | + <summary :class="summaryClass"> |
| 76 | + <span>{{ entry.question }}</span> |
| 77 | + <span :class="toggleClass" aria-hidden="true">+</span> |
| 78 | + </summary> |
| 79 | + <div :class="proseClass"> |
| 80 | + <ContentRenderer :value="entry" /> |
| 81 | + </div> |
| 82 | + </details> |
| 83 | + </div> |
| 84 | + </section> |
| 85 | +</template> |
0 commit comments