import React from 'react'; import { CommonPhotosRenderer } from './CommonPhotosRenderer'; import { CommonTabPageRendererProps } from './CommonTabPage'; import { ArticlePhoto } from '../dto/site/ArticlePhoto'; import { ArticleEx } from '../dto/site/ArticleEx'; import { HtmlContent } from './HtmlContent'; /** * Common content list tab page * @param props Props * @returns Component */ export function CommonContentListPage(props: CommonTabPageRendererProps) { // Destruct const { tab, articles, noDescription, photosRenderer = CommonPhotosRenderer } = props; const photos: ArticlePhoto[] = []; // Layout return ( {!noDescription && tab.description && (
{tab.description}
)}
{articles.map((raw) => { // Type assertion // Data loaded with StaticTabPage // withContent: tab.layout === TabLayout.ContentList const article = raw as ArticleEx; if (article.photos) photos.push(...article.photos); return (
{article.title}
); })}
{photosRenderer({ photos, noContent: false })}
); }