diff --git a/src/components/pages/Timeline/components/ModuleHeading/index.tsx b/src/components/pages/Timeline/components/ModuleHeading/index.tsx index 313f7e3b140c32de5b79c495244b97d8cd2b2845..9ed67a7597fc7060f466f1dc4039763549cbc9f6 100644 --- a/src/components/pages/Timeline/components/ModuleHeading/index.tsx +++ b/src/components/pages/Timeline/components/ModuleHeading/index.tsx @@ -1,15 +1,20 @@ -import React from "react"; +import React, { CSSProperties } from "react"; import Card from "react-bootstrap/Card"; import styles from "./style.module.scss"; export interface ModuleHeadingprops { moduleCode: string; title: string; + style?: CSSProperties; } -const ModuleHeading: React.FC<ModuleHeadingprops> = ({ moduleCode, title }) => { +const ModuleHeading: React.FC<ModuleHeadingprops> = ({ + moduleCode, + title, + style, +}) => { return ( - <Card className={styles.moduleCard}> + <Card style={style} className={styles.moduleCard}> <Card.Header> <span>{moduleCode}</span> </Card.Header> diff --git a/src/components/pages/Timeline/index.tsx b/src/components/pages/Timeline/index.tsx index 6b91494d4c48356ea57ea69522b69a075a980066..f32a920294873a7b52775771c5d3fc83fd99eeb5 100644 --- a/src/components/pages/Timeline/index.tsx +++ b/src/components/pages/Timeline/index.tsx @@ -33,7 +33,7 @@ class Timeline extends React.Component<TimelineProps, TimelineState> { this.props.initSideBar(); let moduleTracks: ModuleTracks = {}; modulesList.forEach(({ code }) => { - moduleTracks[code] = [[], []]; + moduleTracks[code] = [[], []]; }); this.setState({ moduleTracks: moduleTracks }); } @@ -62,13 +62,12 @@ class Timeline extends React.Component<TimelineProps, TimelineState> { const tracks = this.state.moduleTracks[code]; if (tracks) { moduleHeadings.push( - <div + <ModuleHeading key={code} - className={styles.moduleHeading} style={{ height: `${tracks.length * trackHeight}rem` }} - > - <ModuleHeading moduleCode={code} title={modulesList[i].title} /> - </div> + moduleCode={code} + title={modulesList[i].title} + /> ); const timelineBackgroundsClass = classNames( i % 2 === 0