portfolio_leptos/src/components/timeline/TimelineCard.tsx

26 lines
562 B
TypeScript
Raw Normal View History

2023-06-03 18:26:08 +02:00
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