Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor phase 2 #79

Draft
wants to merge 4 commits into
base: github-page
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
Expand Down
93 changes: 45 additions & 48 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ body {
gap: 16px;
}

.routerLink .appTitle {
.appTitle {
overflow: hidden;
white-space: nowrap;
color: var(--colorBrandForegroundLink);
width: max-content;
display: block;
}

.bookmarkedStop,
.etaCardStopInfo,
.etaCardHeader,
.routeCard {
color: var(--colorBrandForegroundLink);
cursor: pointer;
Expand All @@ -104,9 +106,8 @@ main {
width: 100%;
}

.countdownListContainer ul,
.stopsListContainer ul,
.bookmarkContainer ul,
.etaCardContainer ul,
.bottomNav ul,
.sideNav ul,
.linePage ul {
Expand Down Expand Up @@ -138,20 +139,7 @@ main {
flex-direction: column;
}

.countdownListContainer .stopPredictionDetails {
margin-top: 32px;
}

.countdownRow {
display: flex;
align-items: center;
}

.countdownButtonGroup {
margin: 8px 0px 0px 0px;
}

.countdownSec {
.countdown {
padding: 0px 4px;
display: flex;
align-items: baseline;
Expand All @@ -162,35 +150,23 @@ main {
align-self: center;
}

.stopPredictionDetails {
display: flex;
flex-direction: column;
}

.bookmarkContainer ul {
.etaCardContainer ul {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
gap: 24px;
margin: 32px 0;
}

.bookmarkContainer .bookmarkClearButton {
.etaCardContainer {
margin-bottom: 32px;
width: 100%;
}

.bookmarkContainer ul .cardContainer {
overflow: unset;
padding: 8px 16px 16px 16px;
}

/* .bookmarkContainer ul a, */
.bottomNav a,
.sideNav a,
.settingsPage a,
.routerLink,
.countdownRow a,
.bookmarkContainer a {
.etaCardContainer a {
text-decoration: none;
}

Expand All @@ -206,19 +182,49 @@ pre {
.routeCard {
display: flex;
align-items: center;
gap: 16px;
}

.itemInfoPlaceholder {
margin-top: 16px;
margin-bottom: 16px;
}

.clickableCard:hover {
background-color: var(--colorNeutralBackground2);
.etaCardBranchTagAndDestination {
display: flex;
}

.etaCardDestinationInfo {
margin-top: auto;
margin-bottom: auto;
display: grid;
gap: 12px;
}

.etaCard {
position: relative;
}

.etaBadgeContainer {
margin-top: auto;
margin-bottom: auto;
}

.etaCardList li {
display: flex;
flex-direction: column;
min-height: 136px;
}

.etaCardList li > * {
flex: 1;
}

.TitleLink {
color: var(--colorBrandForegroundLink);
}

@media screen and (min-width: 800px) {
.stopPredictionPage,
.linePage,
.homePage {
width: 100%;
Expand All @@ -240,7 +246,7 @@ pre {
}

.etaCardCountdown {
min-width: 160px;
min-width: 80px;
}

.etaCardCountdown > * {
Expand All @@ -249,7 +255,7 @@ pre {
}

@media (max-width: 800px) {
.bookmarkContainer ul {
.etaCardContainer ul {
grid-template-columns: auto;
}
}
Expand All @@ -258,13 +264,4 @@ pre {
.searchBlock button {
width: 100%;
}

.bookmarkedStop .badgeGroup .bookmarkedEta {
display: flex;
flex-wrap: wrap;
gap: 4px;
}
.bookmarkedStop .bookmarkedEta .badgeGroup > * {
margin: 0;
}
}
14 changes: 5 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link as LinkFluent, Title1 } from "@fluentui/react-components";
import { Title1 } from "@fluentui/react-components";
// eslint-disable-next-line no-unused-vars
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
Expand All @@ -23,20 +23,16 @@ function App() {
<div className="container">
<header className="navBar">
<Link
className="routerLink"
className="appTitle"
to={"/"}
title={t("home.title.tooltip") || ""}
>
<LinkFluent>
<Title1 className="appTitle text-xl font-bold">
{t("home.title.name")}
</Title1>
</LinkFluent>
<Title1 className="text-xl font-bold">{t("home.title.name")}</Title1>
</Link>
{width >= 800 && <SideBar width={width} />}
<SideBar width={width} />
</header>
<Outlet />
{width < 800 && <BottomBar width={width} />}
<BottomBar width={width} />
</div>
);
}
Expand Down
43 changes: 21 additions & 22 deletions src/components/accordions/StopAccordions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,39 @@ import {
AccordionPanel,
Badge,
} from "@fluentui/react-components";
import { useCallback } from "react";

import { LineStopElement } from "../../models/etaObjects";
import { StopAccordionsParams } from "../../models/lineStop";
import { fluentStyles } from "../../styles/fluent";
import { parseRoute } from "../parser/routeName";
import { removeSpecialChars } from "../utils/routeName";

export function StopAccordions(props: {
result: LineStopElement[];
title: string;
direction: string;
lineNum: number;
tag: string;
}) {
export function StopAccordions(props: StopAccordionsParams) {
const fluentStyle = fluentStyles();

const stops = props.result.map((lineStop) => {
return (
<li key={`${props.lineNum}-${props.direction}-${lineStop.key}`}>
<AccordionPanel className={fluentStyle.accordionPanel}>
<div className="lineDetails">{lineStop.stopId} </div>
<div className="lineDetails">{lineStop.latlong} </div>
<div className="lineDetails">{lineStop.name}</div>
</AccordionPanel>
</li>
);
});
const StopsDetails = useCallback(() => {
const stops = props.result.map((lineStop) => {
return (
<li key={`${props.lineNum}-${props.direction}-${lineStop.key}`}>
<AccordionPanel className={fluentStyle.accordionPanel}>
<div className="lineDetails">{lineStop.stopId} </div>
<div className="lineDetails">{lineStop.latlong} </div>
<div className="lineDetails">{lineStop.name}</div>
</AccordionPanel>
</li>
);
});

return <ul>{stops}</ul>;
}, [props]);

return (
<AccordionItem value={props.tag}>
<AccordionHeader className={fluentStyle.accordionHeader}>
<Badge className={fluentStyle.badge}>{props.direction}</Badge>
<Badge className={fluentStyle.badge}>{props.lineNum}</Badge>
{parseRoute(props.title)}
{removeSpecialChars(props.title)}
</AccordionHeader>
<ul>{stops}</ul>
<StopsDetails />
</AccordionItem>
);
}
104 changes: 0 additions & 104 deletions src/components/bookmarks/Bookmark.tsx

This file was deleted.

Loading