2023-06-03 18:26:08 +02:00
|
|
|
import react, {Children, ReactNode} from 'react'
|
2023-06-03 18:32:35 +02:00
|
|
|
import TimelineCardSummary from './TimelineCardSummary'
|
2023-06-04 21:31:45 +02:00
|
|
|
import { FaCaretDown } from 'react-icons/fa'
|
2023-06-03 18:26:08 +02:00
|
|
|
|
|
|
|
type TimelineCardProps = {
|
2023-06-03 18:32:35 +02:00
|
|
|
children: react.ReactElement<any, react.JSXElementConstructor<any>>[]
|
2023-06-03 18:26:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function TimelineCard({ children } : TimelineCardProps) {
|
|
|
|
let titles : ReactNode[] = []
|
|
|
|
let childrens : ReactNode[] = []
|
|
|
|
Children.forEach(children, (c) => {
|
2023-06-04 16:02:45 +02:00
|
|
|
if (c.type === TimelineCardSummary) {
|
2023-06-03 18:26:08 +02:00
|
|
|
titles.push(c)
|
|
|
|
} else {
|
|
|
|
childrens.push(c)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return (
|
|
|
|
<details>
|
2023-06-04 21:31:45 +02:00
|
|
|
<summary>
|
|
|
|
{titles}
|
|
|
|
<i><FaCaretDown/></i>
|
|
|
|
</summary>
|
2023-06-03 18:26:08 +02:00
|
|
|
<div>{childrens}</div>
|
|
|
|
</details>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TimelineCard
|