-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rework system selection and put each system on individual pages
- Loading branch information
Showing
17 changed files
with
333 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import React from 'react' | ||
|
||
import { Link } from 'gatsby' | ||
|
||
interface ICardLinkProps { | ||
title: React.ReactNode | ||
description?: React.ReactNode | ||
to: string | ||
className?: string | ||
} | ||
|
||
const CARD_PADDING = 16 as const | ||
|
||
function CardLink({ title, description, to, className }: ICardLinkProps) { | ||
return ( | ||
<Link | ||
className={className} | ||
to={to} | ||
css={{ | ||
textDecoration: 'none !important', | ||
display: 'flex', | ||
border: '2px solid black', | ||
outline: '0px solid black', | ||
background: 'white', | ||
|
||
'&:hover, &:focus, &:active': { | ||
outlineWidth: 2, | ||
'& $arrow': { | ||
'&::after': { | ||
transform: 'translateX(3px) scaleY(0.92) scaleX(1.05) rotate(45deg)', | ||
}, | ||
}, | ||
}, | ||
}} | ||
> | ||
<article | ||
css={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
padding: CARD_PADDING, | ||
position: 'relative', | ||
flexGrow: 1, | ||
}} | ||
> | ||
<header | ||
css={{ | ||
display: 'flex', | ||
gap: 8, | ||
}} | ||
> | ||
<h3 | ||
css={[ | ||
{ | ||
flexGrow: 1, | ||
}, | ||
!description && { | ||
marginBottom: 0, | ||
}, | ||
]} | ||
> | ||
{title} | ||
</h3> | ||
</header> | ||
|
||
{description && ( | ||
<> | ||
<div | ||
aria-hidden | ||
css={{ | ||
flexGrow: 1, | ||
}} | ||
/> | ||
<p>{description}</p> | ||
</> | ||
)} | ||
</article> | ||
|
||
<div | ||
role="presentation" | ||
aria-hidden="true" | ||
css={{ | ||
display: 'inline-flex', | ||
alignItems: 'center', | ||
padding: '10px 18px', | ||
paddingRight: 20, | ||
gap: 8, | ||
transformOrigin: 'center', | ||
'&::after': { | ||
content: '""', | ||
display: 'inline-block', | ||
width: '0.75em', | ||
height: '0.75em', | ||
borderTop: '2px solid currentColor', | ||
borderRight: '2px solid currentColor', | ||
transform: 'rotate(45deg)', | ||
}, | ||
}} | ||
/> | ||
</Link> | ||
) | ||
} | ||
|
||
export default CardLink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import Layout from '@components/Layout' | ||
import AnnouncementPanel from '@components/AnnouncementPanel' | ||
import NavBar from '@components/NavBar' | ||
import Disclaimers from '@components/Disclaimers' | ||
|
||
import RailSymbol from '@assets/rail-symbol-2/white-on-red-inset.svg' | ||
|
||
import { Link, PageProps } from 'gatsby' | ||
|
||
import BackIcon from 'mdi-react/ArrowLeftIcon' | ||
|
||
import type AnnouncementSystem from '@announcement-data/AnnouncementSystem' | ||
import type StationAnnouncementSystem from '@announcement-data/StationAnnouncementSystem' | ||
import type TrainAnnouncementSystem from '@announcement-data/TrainAnnouncementSystem' | ||
|
||
interface IProps { | ||
location: PageProps['location'] | ||
system: new () => TrainAnnouncementSystem | StationAnnouncementSystem | AnnouncementSystem | ||
} | ||
|
||
export default function SystemPageTemplate({ location, system }: IProps) { | ||
return ( | ||
<Layout location={location}> | ||
<header> | ||
<h1 | ||
css={{ | ||
fontSize: '2rem', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
<img | ||
alt="" | ||
role="presentation" | ||
css={{ | ||
height: 64, | ||
width: 64, | ||
marginRight: 16, | ||
marginTop: -3, | ||
}} | ||
src={RailSymbol} | ||
/> | ||
<span>Rail announcements</span> | ||
</h1> | ||
</header> | ||
|
||
<NavBar /> | ||
|
||
<main css={{ margin: '0 24px' }}> | ||
<Link css={{ marginTop: 24, display: 'inline-block' }} className="button" to="/"> | ||
<span className="buttonLabel"> | ||
<BackIcon /> Back to system selection | ||
</span> | ||
</Link> | ||
|
||
<AnnouncementPanel system={system} /> | ||
</main> | ||
|
||
<Disclaimers /> | ||
</Layout> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import BombardierXstar from '@announcement-data/systems/rolling-stock/BombardierXstar' | ||
|
||
import SystemPageTemplate from '@components/SystemPageTemplate' | ||
|
||
import type { PageProps } from 'gatsby' | ||
|
||
export default function BombardierXstarPage({ location }: PageProps) { | ||
return <SystemPageTemplate system={BombardierXstar} location={location} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ThameslinkClass700 from '@announcement-data/systems/rolling-stock/TLClass700' | ||
|
||
import SystemPageTemplate from '@components/SystemPageTemplate' | ||
|
||
import type { PageProps } from 'gatsby' | ||
|
||
export default function Class700Page({ location }: PageProps) { | ||
return <SystemPageTemplate system={ThameslinkClass700} location={location} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import LnerAzuma from '@announcement-data/systems/rolling-stock/LNERAzuma' | ||
|
||
import SystemPageTemplate from '@components/SystemPageTemplate' | ||
|
||
import type { PageProps } from 'gatsby' | ||
|
||
export default function LnerAzumaPage({ location }: PageProps) { | ||
return <SystemPageTemplate system={LnerAzuma} location={location} /> | ||
} |
Oops, something went wrong.