Skip to content

Commit

Permalink
chore: make icon clickable in route suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
tekoiv committed Nov 6, 2023
1 parent edeb1da commit 8f439cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
21 changes: 19 additions & 2 deletions app/component/LegInfo.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import React from 'react';
import React, { useState } from 'react';
import cx from 'classnames';
import Link from 'found/Link';
import moment from 'moment';
import PropTypes from 'prop-types';
import { intlShape } from 'react-intl';
import Modal from '@hsl-fi/modal';
import { getRouteMode } from '../util/modeUtils';
import RouteNumber from './RouteNumber';
import { PREFIX_ROUTES, PREFIX_STOPS } from '../util/path';
import { getCapacityForLeg } from '../util/occupancyUtil';
import Icon from './Icon';
import CapacityModal from './CapacityModal';

/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
const LegInfo = (
{
leg,
Expand All @@ -21,6 +24,7 @@ const LegInfo = (
},
{ config, intl },
) => {
const [capacityModalOpen, setCapacityModalOpen] = useState(false);
const { constantOperationRoutes } = config;
const shouldLinkToTrip =
!constantOperationRoutes || !constantOperationRoutes[leg.route.gtfsId];
Expand Down Expand Up @@ -79,7 +83,10 @@ const LegInfo = (
</div>
)}
{capacity && (
<span className="capacity-icon-container">
<span
className="capacity-icon-container"
onClick={() => setCapacityModalOpen(true)}
>
<Icon
width="1.75"
height="1.75"
Expand All @@ -103,6 +110,16 @@ const LegInfo = (
</span>
</>
)}
<Modal
appElement="#app"
contentLabel="Capacity modal"
closeButtonLabel="Close"
variant="small"
isOpen={capacityModalOpen}
onCrossClick={() => setCapacityModalOpen(false)}
>
<CapacityModal config={config} />
</Modal>
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions app/component/itinerary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,7 @@ $itinerary-tab-switch-height: 48px;
.capacity-icon-container {
color: #007ac9;
margin-top: 2px;
cursor: pointer;
}
}
.itinerary-leg-text-gray {
Expand Down

0 comments on commit 8f439cf

Please sign in to comment.