Skip to content
Snippets Groups Projects
Commit c0846693 authored by Sreeram, Sudarshan's avatar Sreeram, Sudarshan :carrot:
Browse files

Update layout and styling of timeline page

Note: We're going to be using CSS Grids for the timeline instead of
tables. This drastically simplifies the placing of elements in the
timeline.
parent f8e2ff2a
No related branches found
No related tags found
No related merge requests found
...@@ -25,78 +25,39 @@ class Timeline extends React.Component<TimelineProps, {}> { ...@@ -25,78 +25,39 @@ class Timeline extends React.Component<TimelineProps, {}> {
<> <>
<div className={styles.timelineContainer}> <div className={styles.timelineContainer}>
<MyBreadcrumbs /> <MyBreadcrumbs />
<div className={styles.timeline}> <div className={styles.timelineGrid}>
<Table className={styles.timelineTable} bordered striped hover> <div className={styles.timelineTermSwitcher}>
<thead> <TermSwitcher />
<tr className={styles.tableRow}> </div>
<th className={styles.tableHeading}> <div className={styles.timelineWeekRow}>
<TermSwitcher /> {[...Array(12)].map((e, i) => {
</th> return (
<th className={styles.tableWeekRow}> <div className={styles.weekHeading}>
{[...Array(12)].map((e, i) => { <WeekHeading />
return ( </div>
<div className={styles.weekHeading}> );
<WeekHeading /> })}
</div> </div>
); <div className={styles.timelineModuleColumn}>
})} <div className={styles.moduleHeading}>
</th> <ModuleHeading
</tr> moduleCode="CO112"
</thead> title="Introduction to Computer Systems"
<tbody> />
<tr> </div>
<th className={styles.moduleHeading}> <div className={styles.moduleHeading}>
<ModuleHeading <ModuleHeading
moduleCode="CO112" moduleCode="CO120.1"
title="Introduction to Computer Systems" title="Programming I (Haskell)"
/> />
</th> </div>
<td className={styles.rowContent}> <div className={styles.moduleHeading}>
{[...Array(12)].map((e, i) => { <ModuleHeading
return ( moduleCode="CO120.2"
<div className={styles.dummy}> title="Programming II (Java)"
some text />
</div> </div>
); </div>
})}
</td>
</tr>
<tr>
<th className={styles.moduleHeading}>
<ModuleHeading
moduleCode="CO120.1"
title="Programming I (Haskell)"
/>
</th>
<td className={styles.rowContent}>
{[...Array(12)].map((e, i) => {
return (
<div className={styles.dummy}>
some text
</div>
);
})}
</td>
</tr>
<tr>
<th className={styles.moduleHeading}>
<ModuleHeading
moduleCode="CO120.2"
title="Programming II (Java)"
/>
</th>
<td className={styles.rowContent}>
{[...Array(12)].map((e, i) => {
return (
<div className={styles.dummy}>
some text
</div>
);
})}
</td>
</tr>
</tbody>
</Table>
</div> </div>
</div> </div>
</> </>
......
.timelineContainer { .timelineContainer {
margin-top: 1.875rem; margin-top: 1.875rem;
margin-left: 1.875rem; margin-left: 1.875rem;
margin-right: 1.875rem; margin-right: 1.875rem;
} }
.tableHeading { .timelineGrid {
left: 0; display: grid;
top: 0; grid-template-areas: "switcher weeks" "modules .";
z-index: 1; grid-template-rows: auto;
position: -webkit-sticky; /* for Safari */ row-gap: 0.625rem;
position: sticky; overflow: scroll;
background-color: var(--background-color); margin-bottom: 1.25rem;
} margin-left: -0.625rem;
grid-template-columns: 16.875rem auto;
.weekHeading:not(:last-child) {
margin-right: 0.625rem;
} }
.moduleHeading { .timelineTermSwitcher {
position: -webkit-sticky; /* for Safari */ grid-area: switcher;
position: sticky; top: 0;
left: 0; left: 0;
background-color: var(--background-color); position: sticky;
} z-index: 1;
background: var(--background-color);
.timeline { padding-right: 1.25rem;
overflow: scroll; padding-left: 0.625rem;
height: 400px; box-sizing: border-box;
} }
.dummy { .timelineTermSwitcher > * {
color: var(--primary-text-color); width: 100%;
} }
.tableWeekRow { .timelineWeekRow {
display: flex; grid-area: weeks;
display: grid;
grid-auto-flow: row;
grid-template-columns: repeat(12, 15rem);
grid-gap: 0.625rem;
top: 0; top: 0;
position: -webkit-sticky; /* for Safari */
position: sticky; position: sticky;
background-color: var(--background-color);
align-items: stretch;
} }
.rowContent { .timelineModuleColumn {
display: flex; grid-area: modules;
display: grid;
grid-gap: 0.625rem;
left: 0;
position: sticky;
padding-right: 1.25rem;
box-sizing: border-box;
padding-left: 0.625rem;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment