digitransit-ui/digitransit-component/packages/digitransit-component-control-panel
2025-05-21 18:37:05 +03:00
..
src chore: remove outdated introduction feature 2024-09-04 11:00:17 +03:00
index.js chore: in NODE_ENV=development, use dev bundles with included inline sourcemaps 2022-05-20 14:15:30 +03:00
LICENSE-AGPL.txt fix: simplified without DT* depedencies 2020-03-19 09:58:56 +02:00
LICENSE-EUPL.txt fix: simplified without DT* depedencies 2020-03-19 09:58:56 +02:00
package.json chore: update i18next to latest versionb which works without esm6 2025-05-21 18:37:05 +03:00
README.md fix: only fetch alerts that are relevant to the config 2020-12-07 17:16:09 +02:00
test.js fix: import path 2020-08-21 10:10:15 +03:00

@digitransit-component/digitransit-component-control-panel

NearStopsAndRoutes

Show button links to near you page for different travel modes

Parameters

  • props Object
    • props.modes Array<string> Names of transport modes to show buttons for. Should be in lower case. Also defines button order
    • props.urlPrefix string URL prefix for links. Must end with /lahellasi
    • props.language string Language used for accessible labels
    • props.showTitle boolean Show title, default is false
    • props.alertsContext Object
      • props.alertsContext.getModesWithAlerts function Function which should return an array of transport modes that have active alerts (e.g. [BUS, SUBWAY])
      • props.alertsContext.currentTime Number Time stamp with which the returned alerts are validated with
      • props.alertsContext.feedIds Number feedIds for which the alerts are fetched for
    • props.LinkComponent element React component for creating a link, default is undefined and normal anchor tags are used
    • props.origin
    • props.omitLanguageUrl

Examples

const alertsContext = {
   getModesWithAlerts: () => ({}),
   currentTime: 123456789,
   feedIds: [HSL]
}
<CtrlPanel.NearStopsAndRoutes
     modes={['bus', 'tram', 'subway', 'rail', 'ferry', 'citybike']}
     language="fi"
     urlPrefix="http://example.com/lahellasi"
     showTitle
     alertsContext={alertsContext}
   />

CtrlPanel

Extends React.Component

CtrlPanel gathers multiple components to same area (desktop-size: left or mobile-size: bottom)

Examples

<CtrlPanel language="fi" position="left">
   <CtrlPanel.OriginToDestination showTitle />
   <CtrlPanel.SeparatorLine />
   <CtrlPanel.NearStopsAndRoutes
     modes={['bus', 'tram', 'subway', 'rail', 'ferry', 'citybike']}
     language="fi"
     urlPrefix="http://example.com/lahellasi"
     showTitle
   />
 </CtrlPanel>

This module is part of the Digitransit-ui project. It is maintained in the HSLdevcom/digitransit-ui repository, where you can create PRs and issues.

Installation

Install this module individually:

$ npm install @digitransit-component/digitransit-component-control-panel

Or install the digitransit-component module that includes it as a class:

$ npm install @digitransit-component/digitransit-component