Timeline: Use component
This commit is contained in:
parent
92a9a931cb
commit
c5d61f5466
7 changed files with 130 additions and 45 deletions
26
src/components/timeline/TimelineCard.tsx
Normal file
26
src/components/timeline/TimelineCard.tsx
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue