// Generated with util/create-component.js
import React, { memo } from "react";
import Collapse from "../../UI/Collapse";
import Heading from "../../UI/Heading";
import TextElement from "../Text";
import { ICollapseWithArticleListProps } from "./CollapseWithArticleList.types";
const CollapseWithArticleList = ({
mainTitle,
articleCount,
articleList,
defaultCollapsed,
}: ICollapseWithArticleListProps) => {
return (
{articleList.map(
({ articleTitle, paragraphList, paragraphCount }, articleIndex) => {
// contents editor에서 articleCount의 default data를 미리 10개로 설정해둠에 따라 설정한 articleCount 만큼만 보이도록 조건 처리
// TODO : 나중에 contents editor에서 article의 default data를 미리 생성하지 않도록 수정되면 그 때 아래 로직 삭제 필요
if (articleIndex + 1 > articleCount) {
return;
}
return (
{paragraphList.map(
({ paragraphTitle, content }, paragraphIndex) => {
// contents editor에서 paragraphCount default data를 미리 10개로 설정해둠에 따라 설정한 paragraphCount 만큼만 보이도록 조건 처리
// TODO : 나중에 contents editor에서 paragraph의 default data를 미리 생성하지 않도록 수정되면 그 때 아래 로직 삭제 필요
if (paragraphIndex + 1 > paragraphCount) {
return;
}
return (
);
}
)}
);
}
)}
);
};
export default memo(CollapseWithArticleList);