// Import Swiper styles if swiper used on page import 'swiper/css' import Link from 'next/link' import { useState } from 'react' import { Swiper, SwiperSlide } from 'swiper/react' import { Button, Tabs } from 'ui' import CodeBlock, { LANG } from '../CodeBlock/CodeBlock' import { ArrowUpRight } from 'lucide-react' export interface APIExample { lang: LANG title: string code: string } interface Props { size?: 'small' | 'large' content: APIExample[] title: string | React.ReactNode footer?: React.ReactNode text?: React.ReactNode autoHeight?: boolean documentation_link?: string showLineNumbers?: boolean ctaLabel?: string } function APISection(props: Props) { // store API swiper instance const [apiSwiper, setApiSwiper] = useState(undefined) const [apiSwiperActiveIndex, setApiSwiperActiveIndex] = useState(0) function handleApiSwiperNavChange(e: number) { setApiSwiperActiveIndex(e) // @ts-ignore apiSwiper.slideTo(e) } return (

{props.title}

{props.text}
{props.documentation_link && ( )} {props.footer &&
{props.footer}
}
handleApiSwiperNavChange(Number(id))} > {props.content && props.content.map((content: APIExample, i) => ( ))}
{props.content && props.content.map((content: APIExample, i) => ( {content.code} ))}
) } export default APISection