Skip to content

Commit 45b6fdb

Browse files
authored
Merge pull request #5811 from HSLdevcom/AB#483-v3
Ab#483 Route page refactoring and new design for v3
2 parents bce82f2 + 355278d commit 45b6fdb

92 files changed

Lines changed: 5540 additions & 3826 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/component/AgencyInfo.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ function AgencyInfo({ agencyName, url }) {
1010
return (
1111
<div className="agency-link-container">
1212
<ExternalLink className="agency-link" href={link}>
13-
<div className={agencyName.length > 30 ? 'overflow-fade' : ''}>
14-
{agencyName}
15-
</div>
13+
{agencyName}
1614
</ExternalLink>
1715
</div>
1816
);

app/component/DisruptionInfoButton.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function DisruptionInfoButton(props, { config }) {
2626
)}
2727
{props.viewer?.alerts?.length > 0 && (
2828
<Icon
29+
aria-hidden="true"
2930
img="icon_caution_white_exclamation"
3031
className="disruption-info"
3132
/>

app/component/ScrollableWrapper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default function ScrollableWrapper({
4040
},
4141
)}
4242
id={id}
43+
tabIndex={scrollable ? -1 : undefined} // Prevents browser from making overflow containers tab stops, which causes screen readers to announce all child content at once.
4344
onScroll={scrollable ? handleScroll : () => {}}
4445
>
4546
{children}

app/component/ThemedIcon.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { Icon as HslFiIconWrapper, Question } from '@hsl-fi/icons';
4+
import { useConfigContext } from '../configurations/ConfigContext';
5+
import SvgIcon from './Icon';
6+
7+
/**
8+
* ICON_MAP maps a logical icon name to:
9+
* - hslFiIcon: the @hsl-fi/icons component (used when iconModeSet === 'hsl')
10+
* - fallbackImg: the SVG sprite id (used for all other themes)
11+
*/
12+
const ICON_MAP = {
13+
Question: { hslFiIcon: Question, fallbackImg: 'icon_info' },
14+
};
15+
16+
const ICON_NAMES = Object.keys(ICON_MAP);
17+
18+
/**
19+
* ThemedIcon renders the correct icon depending on the active theme:
20+
* - HSL theme (iconModeSet === 'hsl'): uses @hsl-fi/icons
21+
* - All other themes: falls back to the SVG sprite via Icon.js
22+
*
23+
* This component is the single place responsible for @hsl-fi/icons imports.
24+
* Usage sites should never import from @hsl-fi/icons directly.
25+
*/
26+
function ThemedIcon({ name, ...rest }) {
27+
const config = useConfigContext();
28+
const { hslFiIcon, fallbackImg } = ICON_MAP[name];
29+
30+
if (config.iconModeSet === 'hsl') {
31+
return <HslFiIconWrapper icon={hslFiIcon} {...rest} />;
32+
}
33+
34+
return <SvgIcon img={fallbackImg} {...rest} />;
35+
}
36+
37+
ThemedIcon.propTypes = {
38+
/** Logical icon name — must exist in ICON_MAP */
39+
name: PropTypes.oneOf(ICON_NAMES).isRequired,
40+
};
41+
42+
export default ThemedIcon;

app/component/alert-banner.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
.alert-container {
1414
display: flex;
1515
margin-bottom: 10px;
16+
margin-top: 16px;
1617
align-items: center;
1718
border: 1px solid #ddd;
1819
border-radius: 5px;

app/component/date-select-grouped.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@
230230
color: inherit !important;
231231
}
232232

233+
.route-schedule-grouped__option--is-focused {
234+
background-color: $suggestion-highlight-color !important;
235+
}
236+
233237
.route-schedule-grouped__option,
234238
.route-schedule-grouped-date-select .date-select {
235239
.date-select-option {

app/component/itinerary/ItineraryCircleLine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ItineraryCircleLine extends React.Component {
5656
<>
5757
<div className="itinerary-icon-container start">
5858
<Icon
59-
img="icon_mapMarker"
59+
img="icon_origin-ellipse"
6060
className="itinerary-icon from from-it"
6161
/>
6262
</div>

app/component/itinerary/ItineraryCircleLineLong.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const ItineraryCircleLineLong = props => {
1515
if (isFirstChild() && top) {
1616
return (
1717
<div className="itinerary-icon-container start">
18-
<Icon img="icon_mapMarker" className="itinerary-icon from from-it" />
18+
<Icon
19+
img="icon_origin-ellipse"
20+
className="itinerary-icon from from-it"
21+
/>
1922
</div>
2023
);
2124
}

app/component/itinerary/ItineraryCircleLineWithIcon.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ class ItineraryCircleLineWithIcon extends React.Component {
5555
if (this.isFirstChild()) {
5656
return (
5757
<div className="itinerary-icon-container start">
58-
<Icon img="icon_mapMarker" className="itinerary-icon from from-it" />
58+
<Icon
59+
img="icon_origin-ellipse"
60+
className="itinerary-icon from from-it"
61+
/>
5962
</div>
6063
);
6164
}

app/component/itinerary/itinerary.scss

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,25 @@ $itinerary-tab-switch-height: 48px;
749749
z-index: 10;
750750

751751
&.start {
752-
top: 12px;
752+
top: 10px;
753+
display: flex;
754+
align-items: center;
755+
justify-content: center;
756+
757+
.icon-container {
758+
display: flex;
759+
align-items: center;
760+
justify-content: center;
761+
}
762+
763+
.icon {
764+
position: relative;
765+
top: 0;
766+
margin-left: 0;
767+
margin-top: 0;
768+
width: 16px;
769+
height: 16px;
770+
}
753771
}
754772

755773
&.bike-park {
@@ -805,8 +823,6 @@ $itinerary-tab-switch-height: 48px;
805823

806824
&.from-it {
807825
@include itineraryTableIcons;
808-
809-
top: -4px;
810826
}
811827

812828
&.via-it {
@@ -2802,7 +2818,10 @@ div.itinerary-container-content {
28022818
a {
28032819
font-weight: $font-weight-medium;
28042820
color: $link-button-color;
2821+
display: block;
28052822
max-width: 100%;
2823+
overflow: hidden;
2824+
text-overflow: ellipsis;
28062825
}
28072826

28082827
.external-link-icon-outer {

0 commit comments

Comments
 (0)