Skip to content

Commit

Permalink
feat(RouteSchedule): add getDelayString prop for custom delay string (#…
Browse files Browse the repository at this point in the history
…728)

* feat(RouteSchedule): add getDelayString prop for custom delay string generation

* chore(release): 1.12.0-beta.0
  • Loading branch information
danji90 authored Aug 14, 2024
1 parent 03d1693 commit f16b419
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react-spatial",
"license": "MIT",
"description": "Components to build React map apps.",
"version": "1.11.6",
"version": "1.12.0-beta.0",
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
Expand Down
11 changes: 10 additions & 1 deletion src/components/RouteSchedule/RouteSchedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
RealtimeLayer as TrackerLayer,
realtimeConfig,
} from "mobility-toolbox-js/ol";
import { getHoursAndMinutes, getDelayString } from "../../utils/timeUtils";
import {
getHoursAndMinutes,
getDelayString as defaultGetDelayString,
} from "../../utils/timeUtils";
import ReactTransitPropTypes from "../../propTypes";
import firstStation from "../../images/RouteSchedule/firstStation.png";
import station from "../../images/RouteSchedule/station.png";
Expand Down Expand Up @@ -118,6 +121,7 @@ function RouteStop({
trackerLayer,
renderStationImg = defaultRenderStationImg,
renderStationName = defaultRenderStationName,
getDelayString = defaultGetDelayString,
stop,
idx,
}) {
Expand Down Expand Up @@ -387,6 +391,11 @@ const propTypes = {
* Function to render header buttons.
*/
renderHeaderButtons: PropTypes.func,

/**
* Function to get the delay string for stations.
*/
getDelayString: PropTypes.func,
};

/**
Expand Down
1 change: 1 addition & 0 deletions src/components/RouteSchedule/RouteSchedule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@ describe("RouteSchedule", () => {
// to test: no departure delay on last station
// to test: no departure date on last station
// to test: font bold on first and last station
// to test: custom getDelayString prop
});
10 changes: 5 additions & 5 deletions src/styleguidist/StyleGuide.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react";
import PropTypes from "prop-types";
import { geopsTheme, Header, Footer } from "@geops/geops-ui";
import {
Hidden,
Paper,
ClickAwayListener,
Collapse,
List,
Expand Down Expand Up @@ -147,7 +147,7 @@ export function StyleGuideRenderer({
]}
/>
<div className={classes.content}>
<Hidden smUp>
<Paper sx={{ display: { xs: "block", sm: "none" } }}>
<div
role="button"
type="button"
Expand Down Expand Up @@ -236,16 +236,16 @@ export function StyleGuideRenderer({
</List>
</ClickAwayListener>
</Collapse>
</Hidden>
</Paper>
<div className={classes.scrollable} ref={(nodee) => setNode(nodee)}>
<Hidden xsDown>
<Paper sx={{ display: { xs: "none", sm: "block" } }}>
<div className={classes.sidebar}>
<header className={classes.version}>
{version && <Version>{version}</Version>}
</header>
{hasSidebar ? toc : null}
</div>
</Hidden>
</Paper>
<main className={classes.main}>{children}</main>
<div className={classes.footerWrapper}>
<Footer
Expand Down

0 comments on commit f16b419

Please sign in to comment.