Skip to content

Commit

Permalink
Add page numbering to other rendering state
Browse files Browse the repository at this point in the history
  • Loading branch information
e-halinen committed Oct 29, 2024
1 parent e69b1e1 commit c9136b9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
11 changes: 1 addition & 10 deletions src/components/lineTimetable/lineTimetable.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@
font-size: 1.75em;
}

.address {
font-family: GothamRounded-Medium;
font-size: 0.6rem;
color: black;
position: absolute;
top: 1110px;
right: var(--border-radius);
}

.validity .title {
font-family: GothamRounded-Medium;
}
Expand Down Expand Up @@ -180,7 +171,7 @@
page-break-after: always;
}

.address {
.pageNumber {
font-family: GothamRounded-Medium;
font-size: 16px;
color: black;
Expand Down
37 changes: 24 additions & 13 deletions src/components/lineTimetable/lineTimetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { shortenTrainParsedLineId } from '../../util/routes';
const MAX_STOPS = 4; // Maximum amount of timed stops rendered on the timetable

const A5_PAGE_HEIGHT = 960;
const PAGE_NUMBER_HEIGHT = 46;
const PAGE_NUMBER_HEIGHT = 21;

const getScheduleWeekdaysText = dayType => {
switch (dayType) {
Expand Down Expand Up @@ -303,7 +303,7 @@ class LineTimetable extends Component {
pageNumberPositions.map((height, index) => {
const pageNumber = index + 1;
return (
<span className={styles.address} style={{ top: `${height}px` }}>
<span className={styles.pageNumber} style={{ top: `${height}px` }}>
{pageNumber}
</span>
);
Expand Down Expand Up @@ -415,6 +415,15 @@ class LineTimetable extends Component {
ref={ref => {
this.content = ref;
}}>
{pageNumberPositions.length > 0 &&
pageNumberPositions.map((height, index) => {
const pageNumber = index + 1;
return (
<span className={styles.pageNumber} style={{ top: `${height}px` }}>
{pageNumber}
</span>
);
})}
{routeGroupsMappedDepartures.map(routeWithDepartures => {
return routeWithDepartures.departuresByDateRanges.map(departuresFordateRange => {
const { nameFi, nameSe, routeIdParsed } = routeWithDepartures;
Expand All @@ -434,17 +443,19 @@ class LineTimetable extends Component {
return (
<div>
{hasDepartures && (
<RouteDepartures
routeIdParsed={routeIdParsed}
nameFi={nameFi}
nameSe={nameSe}
showPrintBtn={this.props.showPrintBtn}
lang={this.props.lang}
departuresByStop={departuresByStop}
dateBegin={dateBegin}
dateEnd={dateEnd}
showTimedStops={showTimedStops}
/>
<div className={styles.pageBreak}>
<RouteDepartures
routeIdParsed={routeIdParsed}
nameFi={nameFi}
nameSe={nameSe}
showPrintBtn={this.props.showPrintBtn}
lang={this.props.lang}
departuresByStop={departuresByStop}
dateBegin={dateBegin}
dateEnd={dateEnd}
showTimedStops={showTimedStops}
/>
</div>
)}
{hasDepartures && (
<AllStopsList
Expand Down

0 comments on commit c9136b9

Please sign in to comment.