import React, { createContext } from 'react' import { ContentTree } from '@financial-times/content-tree' import { Button } from '@financial-times/o3-button' import { ContentProps } from '../../types' /** There may or may not be a main carousel heading. In order to get the heading level correct for the headings in individual carousel cards, we capture what heading levels they should have in context */ export const CarouselCardHeadingLevelContext = createContext<2 | 3>(3) interface CarouselProps extends ContentProps {} /** * Renders a Carousel component * */ const Carousel: React.FC> = ({ content: { title, standfirst, id }, children, }) => { const cardHeadingLevel: 2 | 3 = title ? 3 : 2 return (
{title && (

{title}

)} {standfirst && (

{standfirst}

)} {React.Children.count(children) > 0 && (
    {children}
)}
) } export default Carousel