Timeline: Use component

This commit is contained in:
Florian RICHER 2023-06-03 18:26:08 +02:00
parent 92a9a931cb
commit c5d61f5466
7 changed files with 130 additions and 45 deletions

View file

@ -0,0 +1,26 @@
import react, {Children, ReactNode} from 'react'
import Project from '../../data/Project'
type TimelineCardProps = {
children: ReactNode
}
function TimelineCard({ children } : TimelineCardProps) {
let titles : ReactNode[] = []
let childrens : ReactNode[] = []
Children.forEach(children, (c) => {
if (c.type.name === "TimelineCardSummary") {
titles.push(c)
} else {
childrens.push(c)
}
});
return (
<details>
<summary>{titles}</summary>
<div>{childrens}</div>
</details>
)
}
export default TimelineCard