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

2.0.0 • Public • Published

@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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.04latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.04
1.1.81
1.1.72
1.1.61
1.1.51
1.1.41
1.1.31
1.1.21
1.1.11
1.1.01
1.0.41
1.0.32
1.0.21
1.0.12
1.0.02
0.3.2011
0.3.1915
0.3.182
0.3.172
0.3.161
0.3.157
0.3.141
0.3.131
0.3.121
0.3.111
0.3.101
0.3.92
0.3.822
0.3.71
0.3.62
0.3.55
0.3.45
0.3.32
0.3.21
0.3.11
0.3.01
0.2.720
0.2.61
0.2.51
0.2.42
0.2.31
0.2.21
0.2.11
0.2.01
0.1.61
0.1.51
0.1.41
0.1.311
0.1.21
0.1.12
0.1.01
0.0.121
0.0.111
0.0.101
0.0.92
0.0.81
0.0.71
0.0.61
0.0.51
0.0.41
0.0.32
0.0.21

Package Sidebar

Install

npm i @digitransit-component/digitransit-component-control-panel

Weekly Downloads

166

Version

2.0.0

License

(AGPL-3.0 OR EUPL-1.2)

Unpacked Size

128 kB

Total Files

6

Last publish

Collaborators

  • digitransit