import React, { type FC, type PropsWithChildren } from 'react'; import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; import Typography from '@mui/material/Typography'; import ChevronRightIcon from '@mui/icons-material/ChevronRight'; import classNames from 'classnames'; import ItemsContainer, { type ItemsContainerProps } from 'elements/emby-itemscontainer/ItemsContainer'; import Scroller, { type ScrollerProps } from 'elements/emby-scroller/Scroller'; import Cards from 'components/cardbuilder/Card/Cards'; import Lists from 'components/listview/List/Lists'; import type { CardOptions } from 'types/cardOptions'; import type { ListOptions } from 'types/listOptions'; import type { ItemDto } from 'types/base/models/item-dto'; interface SectionHeaderProps { className?: string; itemsLength?: number; url?: string; title: string; } const SectionHeader: FC = ({ title, className, itemsLength = 0, url }) => { const sectionHeaderClass = classNames( 'sectionTitleContainer sectionTitleContainer-cards', 'padded-left', className ); return ( {url && itemsLength > 5 ? ( {title} ) : ( {title} )} ); }; interface SectionContainerProps { className?: string; items?: ItemDto[]; sectionHeaderProps?: Omit; scrollerProps?: ScrollerProps; itemsContainerProps?: ItemsContainerProps; isListMode?: boolean; isScrollerMode?: boolean; noPadding?: boolean; cardOptions?: CardOptions; listOptions?: ListOptions; } const SectionContainer: FC> = ({ className, sectionHeaderProps, scrollerProps, itemsContainerProps, isListMode = false, isScrollerMode = true, noPadding = false, items = [], cardOptions = {}, listOptions = {}, children }) => { const sectionClass = classNames('verticalSection', className); const renderItems = () => { if (React.isValidElement(children)) { return children; } if (isListMode && !isScrollerMode) { return ; } else { return ; } }; const content = ( {renderItems()} ); return ( {sectionHeaderProps?.title && ( )} {isScrollerMode && !isListMode ? ( {content} ) : ( content )} ); }; export default SectionContainer;