Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
refactor: reuse Accordion wrapper from mdx-components in faq-section
Export the auto-ID Accordion wrapper from mdx-components.tsx and import it in faq-section.tsx instead of duplicating the slugify logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmithamallesh committed
Feb 11, 2026 at 20:24 UTC
bcf58a65d5e9860fdc7dcaecd360503627d566f4
3 files changed
+8
-10
docs/components/toolkits/faq-section.tsx
+3
-3
@@ -1,8 +1,8 @@
1
'use client';
2
3
import { HelpCircle } from 'lucide-react';
4
-import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
5
-import { slugify } from '@/lib/utils';
4
+import { Accordions } from 'fumadocs-ui/components/accordion';
5
+import { Accordion } from '@/mdx-components';
6
7
export interface FaqItem {
8
question: string;
@@ -24,7 +24,7 @@ export function FaqSection({ faq }: FaqSectionProps) {
24
</h2>
25
<Accordions type="single">
26
{faq.map((item) => (
27
- <Accordion key={item.question} title={item.question} id={slugify(item.question)}>
27
+ <Accordion key={item.question} title={item.question}>
28
<div
29
className="prose prose-sm prose-fd max-w-none text-fd-muted-foreground"
30
dangerouslySetInnerHTML={{ __html: item.answer }}
docs/lib/utils.ts
-4
@@ -4,7 +4,3 @@ import { twMerge } from "tailwind-merge"
4
export function cn(...inputs: ClassValue[]) {
5
return twMerge(clsx(inputs))
6
}
7
-
8
-export function slugify(text: string): string {
9
- return text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
10
-}
docs/mdx-components.tsx
+5
-3
@@ -1,10 +1,13 @@
1
import defaultMdxComponents from 'fumadocs-ui/mdx';
2
import type { MDXComponents } from 'mdx/types';
3
-import type { ComponentProps } from 'react';
3
import { Heading } from '@/components/heading';
4
import { YouTube } from '@/components/youtube';
5
import { Tabs, Tab, TabsList, TabsTrigger, TabsContent } from 'fumadocs-ui/components/tabs';
6
import { Accordion as BaseAccordion, Accordions } from 'fumadocs-ui/components/accordion';
7
+import type { ComponentProps } from 'react';
8
+function slugify(text: string): string {
9
+ return text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
10
+}
11
import { Callout } from 'fumadocs-ui/components/callout';
12
import { Step, Steps } from 'fumadocs-ui/components/steps';
13
import { Card, Cards } from 'fumadocs-ui/components/card';
@@ -19,7 +22,6 @@ import { Video } from '@/components/video';
22
import { CapabilityCard, CapabilityList } from '@/components/capability-card';
23
import { ToolkitsLanding } from '@/components/toolkits/toolkits-landing';
24
import { Mermaid } from '@/components/mermaid';
22
-import { slugify } from '@/lib/utils';
25
import { ShieldCheck, Route as RouteIcon } from 'lucide-react';
26
import {
27
Key,
@@ -36,7 +38,7 @@ import {
38
BookOpen,
39
} from 'lucide-react';
40
39
-function Accordion({ id, title, ...props }: ComponentProps<typeof BaseAccordion>) {
41
+export function Accordion({ id, title, ...props }: ComponentProps<typeof BaseAccordion>) {
42
return <BaseAccordion id={id ?? (typeof title === 'string' ? slugify(title) : undefined)} title={title} {...props} />;
43
}
44