Skip to content

Commit

Permalink
feat(map-popup): pass optional closePopup to focus trap
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-corson-ibigroup committed Sep 4, 2024
1 parent b190b7f commit 7fc27ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/map-popup/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const StopDetails = ({ id, setViewedStop }: { id: string, setViewedStop: () => v

type Entity = Stop | Station
type Props = {
closePopup?: (arg?: any) => void
configCompanies?: ConfiguredCompany[];
entity: Entity
getEntityName?: (entity: Entity, configCompanies: Company[],) => string;
Expand All @@ -99,7 +100,7 @@ function entityIsStation(entity: Entity): entity is Station {
/**
* Renders a map popup for a stop, scooter, or shared bike
*/
export function MapPopup({ configCompanies, entity, getEntityName, setLocation, setViewedStop }: Props): JSX.Element {
export function MapPopup({ closePopup = null, configCompanies, entity, getEntityName, setLocation, setViewedStop }: Props): JSX.Element {
const intl = useIntl()
if (!entity) return <></>

Expand All @@ -114,7 +115,7 @@ export function MapPopup({ configCompanies, entity, getEntityName, setLocation,

return (
<S.MapOverlayPopup>
<FocusTrapWrapper id="map-popup">
<FocusTrapWrapper closePopup={closePopup} id={`${entity.id}-popup`}>
<S.PopupTitle>
<FormattedMessage
defaultMessage={defaultMessages["otpUi.MapPopup.popupTitle"]}
Expand Down

0 comments on commit 7fc27ac

Please sign in to comment.