diff --git a/website/package.json b/website/package.json index 34f1270250fcb..17b338cbec4ae 100644 --- a/website/package.json +++ b/website/package.json @@ -10,6 +10,7 @@ "start": "next start" }, "dependencies": { + "@radix-ui/react-accordion": "^1.2.2", "@theguild/components": "^7.6.0", "next": "^15.0.0", "next-sitemap": "^4.2.3", diff --git a/website/src/components/frequently-asked-questions/attach-page-faq-schema.tsx b/website/src/components/frequently-asked-questions/attach-page-faq-schema.tsx new file mode 100644 index 0000000000000..6e45816aaf1b4 --- /dev/null +++ b/website/src/components/frequently-asked-questions/attach-page-faq-schema.tsx @@ -0,0 +1,28 @@ +'use client'; + +import { useEffect } from 'react'; + +export function AttachPageFAQSchema() { + useEffect(() => { + const html = document.querySelector('html'); + + if (!html) { + // This should never happen + return; + } + + const path = window.location.pathname.replace('/graphql/hive', '/'); + + if (!html.hasAttribute('itemscope')) { + html.setAttribute('itemscope', ''); + html.setAttribute('itemtype', 'https://schema.org/FAQPage'); + + return () => { + html.removeAttribute('itemscope'); + html.removeAttribute('itemtype'); + }; + } + }, []); + + return null; +} diff --git a/website/src/components/frequently-asked-questions/index.tsx b/website/src/components/frequently-asked-questions/index.tsx new file mode 100644 index 0000000000000..fdde44a56e479 --- /dev/null +++ b/website/src/components/frequently-asked-questions/index.tsx @@ -0,0 +1,111 @@ +// TODO: Remove this module and use FrequentlyAskedQuestions from @theguild/components v8 when it's +// released and Mesh is migrated to Nextra 4. + +import { Children, ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react'; +import * as RadixAccordion from '@radix-ui/react-accordion'; +import { Anchor, CaretSlimIcon, cn, Heading } from '@theguild/components'; +import { AttachPageFAQSchema } from './attach-page-faq-schema'; +import MeshFAQ from './mesh-faq.mdx'; + +const a = (props: ComponentPropsWithoutRef<'a'>) => ( + + {props.children!} + +); + +const h2 = (props: ComponentPropsWithoutRef<'h2'>) => ( + +); + +const UnwrapChild = (props: { children?: ReactNode }) => props.children as unknown as ReactElement; + +const Accordion = (props: ComponentPropsWithoutRef<'ul'>) => ( + +