@@ -4,13 +4,22 @@ import {
44 AccordionPanel ,
55 Button ,
66} from "@fluentui/react-components" ;
7- import { VehicleBus16Filled } from "@fluentui/react-icons" ;
7+ import { VehicleSubway16Filled } from "@fluentui/react-icons" ;
88import { Link } from "react-router-dom" ;
99
10- import { RouteBranchStops } from "../../models/ttc" ;
11- import { fluentStyles } from "../../styles/fluent" ;
12- import { TtcBadge } from "../badges" ;
13- import { LocationButton } from "./StopAccordions" ;
10+ import { RouteBranchStops } from "../../models/ttc.js" ;
11+ import { fluentStyles } from "../../styles/fluent.js" ;
12+ import { TtcBadge } from "../badges.js" ;
13+ import { LocationButton } from "./StopAccordions.js" ;
14+ import style from "./SubwayAccordions.module.css" ;
15+
16+ const lineColors = new Map ( [
17+ [ 1 , "yellow" ] ,
18+ [ 2 , "green" ] ,
19+ [ 3 , "blue" ] ,
20+ [ 4 , "purple" ] ,
21+ [ 5 , "orange" ] ,
22+ ] ) ;
1423
1524export function SubwayAccordions ( props : {
1625 result : RouteBranchStops [ ] ;
@@ -23,9 +32,21 @@ export function SubwayAccordions(props: {
2332 const stops = props . result . map ( ( lineStop ) => {
2433 return (
2534 < li key = { lineStop . id . toString ( ) } >
26- < AccordionPanel className = { fluentStyle . accordionPanel } >
27- < div className = "line-details" >
28- < ETAButton code = { lineStop . code } line = { props . lineNum } />
35+ < AccordionPanel
36+ className = { [
37+ style [ "subway-accordion-item" ] ,
38+ fluentStyle . accordionPanel ,
39+ ] . join ( " " ) }
40+ >
41+ < div
42+ className = { style [ "station-btn" ] }
43+ style = { { background : lineColors . get ( props . lineNum ) } }
44+ >
45+ < ETAButton
46+ code = { lineStop . code }
47+ line = { props . lineNum }
48+ type = { "subway" }
49+ />
2950 </ div >
3051 < div className = "line-details" >
3152 < LocationButton
@@ -47,15 +68,18 @@ export function SubwayAccordions(props: {
4768 < TtcBadge key = { props . lineNum } lineNum = { props . lineNum . toString ( ) } />
4869 { props . title }
4970 </ AccordionHeader >
50- < ul > { stops } </ ul >
71+ < ul className = { style [ "subway-list" ] } > { stops } </ ul >
5172 </ AccordionItem >
5273 ) ;
5374}
5475
55- function ETAButton ( props : { line : number ; code : string } ) {
76+ function ETAButton ( props : { line : number ; code : string ; type : string } ) {
5677 return (
5778 < Link to = { `/ttc/lines/${ props . line } /${ props . code } ` } title = { "View stop ETA" } >
58- < Button icon = { < VehicleBus16Filled /> } />
79+ < Button
80+ icon = { < VehicleSubway16Filled /> }
81+ shape = { props . type === "subway" ? "circular" : "rounded" }
82+ />
5983 </ Link >
6084 ) ;
6185}
0 commit comments