import '../../elements/emby-itemscontainer/emby-itemscontainer'; import { BaseItemDto } from '@thornbill/jellyfin-sdk/dist/generated-client'; import React, { FunctionComponent, useEffect, useRef } from 'react'; import cardBuilder from '../../components/cardbuilder/cardBuilder'; import ItemsContainerElement from '../../elements/ItemsContainerElement'; import ItemsScrollerContainerElement from '../../elements/ItemsScrollerContainerElement'; import { ICardOptions } from './type'; type SectionContainerProps = { sectionTitle: string; enableScrollX: () => boolean; items?: BaseItemDto[]; cardOptions?: ICardOptions; } const SectionContainer: FunctionComponent = ({ sectionTitle, enableScrollX, items = [], cardOptions = {} }: SectionContainerProps) => { const element = useRef(null); useEffect(() => { cardBuilder.buildCards(items, { itemsContainer: element.current?.querySelector('.itemsContainer'), parentContainer: element.current?.querySelector('.verticalSection'), scalable: true, overlayPlayButton: true, showTitle: true, centerText: true, cardLayout: false, ...cardOptions }); }, [cardOptions, enableScrollX, items]); return (

{sectionTitle}

{enableScrollX() ? : }
); }; export default SectionContainer;