diff --git a/src/App.tsx b/src/App.tsx index 4965994..a803823 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,8 +3,11 @@ import TopComponent from "./components/TopComponent"; import ShortDescription from "./components/ShortDescription"; import Timeline from "./components/timeline/Timeline"; import TimelineElement from "./components/timeline/TimelineElement"; -import {PROJECTS} from "./data/Project"; -import TimelineCard from './components/timeline/TimelineElementCard'; +import { PROJECTS } from "./data/Project"; +import TimelineCard from './components/timeline/TimelineCard'; +import TimelineCardSummary from './components/timeline/TimelineCardSummary'; +import TimelineCardContent from './components/timeline/TimelineCardContent'; +import TimelineLabel from './components/timeline/TimelineLabel'; function App() { return ( @@ -12,32 +15,58 @@ function App() { - - - Youpi + + 2019-2020 + + Limouzik + + Youpi + - - Youpi + + Limouzik + + Youpi + - - Youpi + + Limouzik + + Youpi + - - Youpi + + Limouzik + + Youpi + - - - Youpi + + 2019-2020 + + Limouzik + + Youpi + - - Youpi + + Limouzik + + Youpi + - - Youpi + + Limouzik + + Youpi + - - Youpi + + Limouzik + + Youpi + diff --git a/src/components/timeline/TimelineCard.tsx b/src/components/timeline/TimelineCard.tsx new file mode 100644 index 0000000..14e8422 --- /dev/null +++ b/src/components/timeline/TimelineCard.tsx @@ -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 ( +
+ {titles} +
{childrens}
+
+ ) +} + +export default TimelineCard \ No newline at end of file diff --git a/src/components/timeline/TimelineCardContent.tsx b/src/components/timeline/TimelineCardContent.tsx new file mode 100644 index 0000000..330e965 --- /dev/null +++ b/src/components/timeline/TimelineCardContent.tsx @@ -0,0 +1,14 @@ +import react, {ReactNode} from 'react' +import Project from '../../data/Project' + +type TimelineCardContentProps = { + children: ReactNode +} + +function TimelineCardContent({ children } : TimelineCardContentProps) { + return ( + <>{children} + ) +} + +export default TimelineCardContent \ No newline at end of file diff --git a/src/components/timeline/TimelineCardSummary.tsx b/src/components/timeline/TimelineCardSummary.tsx new file mode 100644 index 0000000..e361802 --- /dev/null +++ b/src/components/timeline/TimelineCardSummary.tsx @@ -0,0 +1,14 @@ +import react, {ReactNode} from 'react' +import Project from '../../data/Project' + +type TimelineCardSummaryProps = { + children: ReactNode +} + +function TimelineCardSummary({ children } : TimelineCardSummaryProps) { + return ( + <>{children} + ) +} + +export default TimelineCardSummary \ No newline at end of file diff --git a/src/components/timeline/TimelineElement.tsx b/src/components/timeline/TimelineElement.tsx index 37cd81b..13b27bf 100644 --- a/src/components/timeline/TimelineElement.tsx +++ b/src/components/timeline/TimelineElement.tsx @@ -1,21 +1,27 @@ import './TimelineElement.scss' -import react, {ReactNode} from 'react' -import Project from '../../data/Project' +import react, {Children, ReactNode} from 'react' type TimelineElementProps = { - category: string, children: ReactNode } -function TimelineElement({ category, children } : TimelineElementProps) { - +function TimelineElement({ children } : TimelineElementProps) { + let labels : ReactNode[] = [] + let cards : ReactNode[] = [] + Children.forEach(children, (c) => { + if (c.type.name === "TimelineLabel") { + labels.push(c) + } else { + cards.push(c) + } + }); return (
  • - { category } + { labels }
    - { children } + { cards }
  • ) diff --git a/src/components/timeline/TimelineElementCard.tsx b/src/components/timeline/TimelineElementCard.tsx deleted file mode 100644 index 16d4df2..0000000 --- a/src/components/timeline/TimelineElementCard.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import react, {ReactNode} from 'react' -import Project from '../../data/Project' - -type TimelineElementCardProps = { - title: string, - children: ReactNode -} - -function TimelineCard({ title, children } : TimelineElementCardProps) { - return ( -
    - {title} -
    {children}
    -
    - ) -} - -export default TimelineCard \ No newline at end of file diff --git a/src/components/timeline/TimelineLabel.tsx b/src/components/timeline/TimelineLabel.tsx new file mode 100644 index 0000000..c1edee9 --- /dev/null +++ b/src/components/timeline/TimelineLabel.tsx @@ -0,0 +1,14 @@ +import react, {ReactNode} from 'react' +import Project from '../../data/Project' + +type TimelineLabelProps = { + children: ReactNode +} + +function TimelineLabel({ children } : TimelineLabelProps) { + return ( + <>{children} + ) +} + +export default TimelineLabel \ No newline at end of file