Skip to content

Commit 4e74f59

Browse files
committed
restyle subway lines
1 parent 7834ec4 commit 4e74f59

File tree

3 files changed

+62
-12
lines changed

3 files changed

+62
-12
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.subway-list {
2+
.subway-accordion-item {
3+
padding: 0 !important;
4+
5+
.station-btn {
6+
padding: 0.5rem 0;
7+
}
8+
}
9+
10+
li:first-child {
11+
.station-btn {
12+
border-radius: 50% 50% 0 0;
13+
padding-top: 0;
14+
margin-top: 0.5rem;
15+
}
16+
}
17+
18+
li:last-child {
19+
.station-btn {
20+
border-radius: 0 0 50% 50%;
21+
padding-bottom: 0;
22+
margin-bottom: 0.5rem;
23+
}
24+
}
25+
}

src/components/accordions/SubwayAccordions.tsx

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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";
88
import { 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

1524
export 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
}

src/styles/fluent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export const fluentStyles = makeStyles({
4949
},
5050
accordionPanel: {
5151
display: "grid",
52-
gridTemplateColumns: "36px 36px auto",
52+
gridTemplateColumns: "min-content min-content auto",
53+
columnGap: "0.5rem",
5354
gridAutoRows: "auto",
5455
paddingTop: "8px",
5556
paddingBottom: "8px",

0 commit comments

Comments
 (0)