import { AnimatePresence, motion, useInView } from 'framer-motion' import { Check } from 'lucide-react' import { useTheme } from 'next-themes' import Link from 'next/link' import React, { useRef, useState } from 'react' import { cn } from 'ui' import BrowserFrame from './BrowserFrame' export type Tab = { label: string panel: React.FC<{ isDark: boolean }> highlights: { label: string; link?: string }[] } interface Props { tabs: Tab[] } const TabsWithHighlights = (props: Props) => { const { resolvedTheme } = useTheme() const [activeTabIdx, setActiveTabIdx] = useState(0) const sectionRef = useRef(null) const isInView = useInView(sectionRef, { once: true }) const Panel: any = props.tabs[activeTabIdx]?.panel ?? null const highlights = props.tabs[activeTabIdx]?.highlights ?? [null] const handleTabClick = (tabIndex: number) => { setActiveTabIdx(tabIndex) } return (
{/* Threshold element used to load video 500px before reaching the video component */}
{props.tabs.map((tab, index) => ( handleTabClick(index)} /> ))}
{highlights?.map((highlight) => (
  • {highlight.label}
  • ))}
    {isInView && ( )}
    ) } interface TabProps { label: string isActive: boolean onClick: VoidFunction } const Tab = ({ label, isActive, onClick }: TabProps) => ( ) export default TabsWithHighlights