26 lines
562 B
TypeScript
26 lines
562 B
TypeScript
|
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
|