diff --git a/src/components/Agenda/Agenda.js b/src/components/Agenda/Agenda.js index e1b999ac2..84cea6320 100644 --- a/src/components/Agenda/Agenda.js +++ b/src/components/Agenda/Agenda.js @@ -6,6 +6,8 @@ import Session from './Session'; import Time from './Time'; import useMedia from 'use-media'; +const hasOwnProperty = Object.prototype.hasOwnProperty; + const Agenda = ({ children, className, tracks, mobileBreakpoint }) => { const isMobileScreen = useMedia({ maxWidth: mobileBreakpoint }); @@ -53,7 +55,18 @@ const Agenda = ({ children, className, tracks, mobileBreakpoint }) => { {!isMobileScreen && ( )} - {sessions.map((session) => cloneElement(session, { isMobileScreen }))} + {sessions.map((session, idx) => { + const trackIdx = sessions + .slice(0, idx) + .reduce((memo, session) => memo + session.props.span, 0); + + return cloneElement(session, { + isMobileScreen, + track: hasOwnProperty.call(session.props, 'track') + ? session.props.track + : tracks[trackIdx], + }); + })} ))} diff --git a/src/components/Agenda/Session.js b/src/components/Agenda/Session.js index 9cc8d0527..98da5ac31 100644 --- a/src/components/Agenda/Session.js +++ b/src/components/Agenda/Session.js @@ -53,7 +53,7 @@ const Session = ({ `} > {time} - {track} + {track && {track}} )} diff --git a/src/pages/nerd-days.js b/src/pages/nerd-days.js index 13bff759e..73ce364e3 100644 --- a/src/pages/nerd-days.js +++ b/src/pages/nerd-days.js @@ -370,106 +370,93 @@ const NerdDaysPage = () => { time="8:00 AM" title="Welcome" speaker="Jemiah Sius" - track="DevOps journey" + track={null} span={5} />