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

AB#32085: Change LineTimetable print layout to A5 #420

Merged
merged 3 commits into from
Oct 15, 2024
Merged
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
7 changes: 7 additions & 0 deletions scripts/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ async function renderComponent(options) {
margin: 0,
timeout: PDF_TIMEOUT,
};
} else if (props.printAsA5) {
printOptions = {
printBackground: true,
format: 'A5',
margin: 0,
timeout: PDF_TIMEOUT,
};
} else {
printOptions = {
printBackground: true,
Expand Down
10 changes: 6 additions & 4 deletions src/components/lineTimetable/allStopsList.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
.stopListsContainer {
margin-top: 2rem;
max-width: 1171px;
margin-top: 1rem;
max-width: 95%;
page-break-inside: avoid;
page-break-after: always;
}

.stopList {
margin-bottom: 2rem;
margin-bottom: 1rem;
padding-left: 1.2rem;
}

.lineInfoText {
font-family: GothamRounded-Book;
font-size: 2rem;
font-size: 1rem;
}

.stopListText {
font-family: GothamRounded-Medium;
font-size: 0.5rem;
}
33 changes: 22 additions & 11 deletions src/components/lineTimetable/lineTableColumns.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
.departureRowContainer {
max-width: 1171px;
max-width: 420px;
min-width: 120px;
font-family: GothamRounded-Book;
margin: 0.5rem 0;
}

.departureRow {
font-size: 1.2rem;
margin-left: 2rem;
font-size: 1rem;
margin-left: 1.6rem;
padding-top: 5px;
padding-bottom: 5px;
height: 35px;
}

.departureColumnContainer {
flex-grow: 1;
align-items: normal;
min-width: 100px;
max-width: 350px;
}

.tableContainer {
Expand All @@ -23,13 +26,14 @@
}

.wider {
min-width: 400px !important;
min-width: 270px;
}

.hour {
font-family: GothamXNarrow-Medium;
min-width: 3rem;
align-self: baseline;
font-size: 15px;
width: 1.5rem;
margin-right: 0.5em;
}

.minutesContainer {
Expand All @@ -40,13 +44,20 @@

.minutes {
display: flex;
min-width: 2em;
padding: 0.25em 0 0 0.6em;
min-width: 0.9em;
font-family: GothamXNarrow-Book;
font-size: 0.75em;
letter-spacing: -0.025em;
font-size: 12px;
letter-spacing: -0.02em;
line-height: 1;
margin-right: 0.25em;
margin-right: 0.2em;
}

.divider {
border-right: 2px solid #3333338a;
}

.departureRowContainer > *:nth-child(even) {
background-color: #eaeaea;
}

@media print {
Expand Down
33 changes: 20 additions & 13 deletions src/components/lineTimetable/lineTableColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { Column, Row, WrappingRow } from '../util';
import LineTableHeader from './lineTableHeader';
import styles from './lineTableColumns.css';
import classNames from 'classnames';
import classnames from 'classnames';
import { isArray, filter, isEmpty, groupBy } from 'lodash';
import { filterDuplicateDepartureHours, getDuplicateCutOff } from '../timetable/tableRows';

Expand All @@ -19,8 +19,8 @@ const LineTimetableRow = props => {
<div className={styles.minutesContainer}>
{sortedMinuteDepartures.map((departure, index) => (
<div className={styles.minutes} key={index}>
{departure.note === 'p'
? `${departure.minutes.toString().padStart(2, '0')} pe`
{departure.note !== null
? `${departure.minutes.toString().padStart(2, '0')}${departure.note}`
: departure.minutes.toString().padStart(2, '0')}
</div>
))}
Expand Down Expand Up @@ -87,8 +87,15 @@ const DeparturesColumn = props => {
});

return (
<div>
<LineTableHeader stop={stop} />
<div
className={classnames({
[styles.wider]: props.showBothDirections,
[styles.divider]: stop.index === 0 && props.showBothDirections,
})}>
<LineTableHeader
stop={stop}
isLastStop={props.showBothDirections ? true : props.isLastStop}
/>
<div className={styles.departureRowContainer}>{departureRows}</div>
</div>
);
Expand All @@ -104,6 +111,8 @@ const DeparturesColumn = props => {
DeparturesColumn.propTypes = {
departures: PropTypes.array.isRequired,
stop: PropTypes.object.isRequired,
showBothDirections: PropTypes.bool.isRequired,
isLastStop: PropTypes.bool.isRequired,
};

const LineTableColumns = props => {
Expand All @@ -117,27 +126,25 @@ const LineTableColumns = props => {
});
return (
<div>
<Column
className={classNames(styles.departureColumnContainer, {
[styles.wider]: showDivider,
})}>
<Column className={styles.departureColumnContainer}>
<DeparturesColumn
departures={departures.combinedDays[validSelectedDay]}
stop={{ ...departures.stop, index }}
showBothDirections={showDivider}
isLastStop={index === departuresByStop.length - 1}
/>
</Column>
</div>
);
}
return (
<div>
<Column
className={classNames(styles.departureColumnContainer, {
[styles.wider]: showDivider,
})}>
<Column className={styles.departureColumnContainer}>
<DeparturesColumn
departures={departures.combinedDays[selectedDepartureDays]}
stop={{ ...departures.stop, index }}
showBothDirections={showDivider}
isLastStop={index === departuresByStop.length - 1}
/>
</Column>
</div>
Expand Down
23 changes: 15 additions & 8 deletions src/components/lineTimetable/lineTableHeader.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
.headerContainer {
display: flex;
}

.stop {
flex-grow: 1;
height: 60px;
height: 50px;
padding-right: 16px;
margin-bottom: 2rem;
margin-bottom: 1.5rem;
}

.stopNamePrimary {
font-size: 1.2em;
margin: 0 0 0 2rem;
font-size: 1rem;
margin: 0 0 0 1.2rem;
font-family: GothamRounded-Medium;
word-break: normal;
}

.stopNameSecondary {
font-size: 1.2em;
margin: 0 0 0 2rem;
font-size: 1rem;
margin: 0 0 0 1.2rem;
font-family: GothamXNarrow-Book;
word-break: normal;
}

.directionBracket {
font-family: GothamRounded-Medium;
font-size: 1rem;
}
12 changes: 8 additions & 4 deletions src/components/lineTimetable/lineTableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ import PropTypes from 'prop-types';
import styles from './lineTableHeader.css';

const LineTableHeader = props => {
const { stop } = props;
const { stop, isLastStop } = props;
return (
<div className={styles.stop}>
<p className={styles.stopNamePrimary}>{stop.nameFi}</p>
<p className={styles.stopNameSecondary}>{stop.nameSe}</p>
<div className={styles.headerContainer}>
<div className={styles.stop}>
<p className={styles.stopNamePrimary}>{stop.nameFi}</p>
<p className={styles.stopNameSecondary}>{stop.nameSe}</p>
</div>
{!isLastStop && <div className={styles.directionBracket}>&gt;</div>}
</div>
);
};

LineTableHeader.propTypes = {
stop: PropTypes.object.isRequired,
isLastStop: PropTypes.bool.isRequired,
};

export default LineTableHeader;
18 changes: 15 additions & 3 deletions src/components/lineTimetable/lineTimetable.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@
}

.timetableDays {
margin: 0 1rem 1rem 2rem;
font-size: 1.5em;
margin: 0 1rem 1rem 1.2rem;
font-size: 0.8em;
font-family: GothamRounded-Book;
word-wrap: break-word;
}

.timetableDates {
margin: 0 1rem 1rem 2rem;
font-size: 1.5em;
font-size: 0.8em;
font-family: GothamRounded-Book;
}

Expand All @@ -168,6 +169,17 @@
page-break-after: always;
}

.fridayNote {
margin-left: 1.5rem;
font-family: GothamRounded-Book;
font-size: 12px;
}

.notesContainer {
margin: 0.5rem 0 1rem 0.5rem;
page-break-after: always;
}

@media print {
.noPrint,
.noPrint * {
Expand Down
Loading
Loading