Skip to content

Commit

Permalink
chore(board) visual changes to the board (#1125)
Browse files Browse the repository at this point in the history
* chore(board): depature time column right aligned

* chore(board): visual changes to the board

* chore(board): correct color on column headers

* chore(board): renaming variables and cutting down css

* chore(board): string instead of boolean to align columnheaders

* chore(board): moved clock css class to components folder

* chore(board): center-align plattform column

* chore(board): change table header color

* chore(board): text-alignment on board and remove css

* chore(board): rename css variable
  • Loading branch information
SharmaTarun1111111 authored Jul 17, 2023
1 parent 31ceea5 commit 0c2a1ef
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.destination {
display: flex;
flex-direction: column;
font-size: 1.5625em;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
max-width: fit-content;
padding: 0.25em;
border-radius: 0.2em;
font-size: 0.9em;
font-size: 1.25em;
font-weight: 500;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useNonNullContext } from 'hooks/useNonNullContext'
import { DepartureContext } from '../../contexts'
import classes from './styles.module.css'

function Platform() {
const departure = useNonNullContext(DepartureContext)

return <td>{departure.quay.publicCode}</td>
return <td className={classes.quayText}>{departure.quay.publicCode}</td>
}

export { Platform }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.quayText {
font-weight: 700;
font-size: 1.5em;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.situation {
color: var(--table-situation-color);
font-size: 0.5em;
font-size: 0.875em;
display: flex;
align-items: center;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Time() {
)
if (timeDeviation > 120) {
return (
<td className={classes.timeDeviationContainer}>
<td className={classes.timeContainer}>
<div className={classes.expectedDepartureTime}>
{getRelativeTimeString(departure.expectedDepartureTime)}
</div>
Expand All @@ -23,7 +23,11 @@ function Time() {
</td>
)
}
return <td>{getRelativeTimeString(departure.expectedDepartureTime)}</td>
return (
<td className={classes.timeContainer}>
{getRelativeTimeString(departure.expectedDepartureTime)}
</td>
)
}

export { Time }
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.timeDeviationContainer {
display: flex;
flex-direction: column;
.timeContainer {
font-weight: 600;
font-size: 1.5em;
}

.aimedDepartureTime {
font-size: 0.5625em;
text-decoration: line-through;
font-size: 0.66em;
}

.expectedDepartureTime {
font-weight: 600;
color: var(--table-time-deviation-color);
}
19 changes: 10 additions & 9 deletions next-tavla/src/Board/scenarios/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { TDepartureFragment } from 'graphql/index'
import {
Columns,
TColumn,
TColumnSize,
TColumnSettings,
DefaultColumns,
TColumnLayout,
TColumnSettings,
} from 'types/column'
import React from 'react'
import classes from './styles.module.css'
Expand All @@ -25,16 +25,16 @@ const columnComponents: Record<TColumn, () => JSX.Element> = {
via: Via,
}

const ColumnOrder: TColumnSize[] = [
const ColumnOrder: TColumnLayout[] = [
{ type: 'line', size: 1 },
{ type: 'destination', size: 2 },
{ type: 'via', size: 2 },
{ type: 'platform', size: 3 },
{ type: 'situations', size: 4 },
{ type: 'destination', size: 6 },
{ type: 'via', size: 5 },
{ type: 'situations', size: 6 },
{ type: 'platform', size: 1 },
{ type: 'time', size: 1 },
]

function ColumnTableHeader({ type, size }: TColumnSize) {
function ColumnTableHeader({ type, size }: TColumnLayout) {
return (
<th
className={classes.header}
Expand Down Expand Up @@ -63,7 +63,7 @@ function Table({
return (
<div className={classes.container}>
<table className={classes.table}>
<thead>
<thead className={classes.row}>
<tr>
{filteredColumnOrder.map((props) => (
<ColumnTableHeader key={props.type} {...props} />
Expand All @@ -73,6 +73,7 @@ function Table({
<tbody>
{departures.map((departure) => (
<tr
className={classes.row}
key={`${departure.serviceJourney.id}_${departure.aimedDepartureTime}`}
>
<DepartureContext.Provider value={departure}>
Expand Down
11 changes: 7 additions & 4 deletions next-tavla/src/Board/scenarios/Table/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
height: 100%;
overflow: hidden;
}

.header {
text-align: left;
font-size: 0.7em;
color: var(--table-header-color);
padding-bottom: 0.4em;
}

.table {
text-align: left;
height: 100%;
border-collapse: collapse;
width: 100%;
Expand All @@ -22,10 +24,11 @@
padding: 0.25em 0;
}

.table tr {
.row {
border-bottom: 2px solid var(--table-border-color);
}

.table thead tr {
border-bottom: 4px solid var(--table-border-color);
.row th:last-child,
.row td:last-child {
text-align: right;
}
7 changes: 6 additions & 1 deletion next-tavla/src/Shared/components/Clock/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react'
import classes from './styles.module.css'

function Clock() {
const [currentTime, setCurrentTime] = useState(Date.now())
Expand All @@ -13,7 +14,11 @@ function Clock() {
timeZone: 'Europe/Oslo',
}).format(currentTime)

return <span suppressHydrationWarning>{time}</span>
return (
<span suppressHydrationWarning className={classes.clock}>
{time}
</span>
)
}

export { Clock }
3 changes: 3 additions & 0 deletions next-tavla/src/Shared/components/Clock/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.clock {
font-size: 1.5625em;
}
4 changes: 2 additions & 2 deletions next-tavla/src/Shared/styles/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--secondary-background-color: var(--colors-greys-grey);
/* --tertiary-background-color not yet defined */

--table-header-color: var(--colors-greys-grey50);
--table-border-color: var(--colors-greys-grey10);
--table-situation-color: var(--colors-validation-canary);
--table-header-color: var(--colors-greys-grey60);
--table-situation-color: var(--feedback-canary-contrast, #ffe082);
}
9 changes: 6 additions & 3 deletions next-tavla/src/Shared/types/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const Columns = {
destination: 'Destinasjon',
line: 'Linje',
platform: 'Plattform',
time: 'Avgangstid',
time: 'Avgang',
situations: 'Avvik',
via: 'Via',
} as const
Expand All @@ -13,10 +13,13 @@ export type TColumnSettings = Partial<Record<TColumn, boolean>>
export const DefaultColumns: TColumnSettings = {
line: true,
destination: true,
platform: false,
platform: true,
situations: true,
time: true,
via: false,
} as const

export type TColumnSize = { type: TColumn; size: number }
export type TColumnLayout = {
type: TColumn
size: number
}

0 comments on commit 0c2a1ef

Please sign in to comment.