'use client' import { useEffect, useRef, type ReactNode } from 'react' import { cn, Tabs, TabsContent, TabsList, TabsTrigger } from 'ui' import { frameworkTitles } from '@/config/docs' import { useFramework } from '@/context/framework-context' export function FrameworkQuickstart({ children }: { children: ReactNode }) { const { framework, setFramework } = useFramework() const tabStripRef = useRef(null) const activeTabRef = useRef(null) useEffect(() => { const strip = tabStripRef.current const tab = activeTabRef.current if (!strip || !tab) return const stripBounds = strip.getBoundingClientRect() const tabBounds = tab.getBoundingClientRect() if (tabBounds.left < stripBounds.left) { strip.scrollLeft += tabBounds.left - stripBounds.left } else if (tabBounds.right > stripBounds.right) { strip.scrollLeft += tabBounds.right - stripBounds.right } }, [framework]) return (
{Object.entries(frameworkTitles).map(([value, label]) => ( {label} ))}
{children}
) } export function FrameworkQuickstartTab({ value, children, }: { value: string children: ReactNode }) { return ( {children} ) } export function QuickstartStep({ number, children }: { number: string; children: ReactNode }) { return (
{children}
) }