mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-08 04:00:38 +02:00
108 lines
2.5 KiB
Markdown
108 lines
2.5 KiB
Markdown
# @digitransit-component/digitransit-component-favourite-bar
|
|
|
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
|
|
## FavouriteBar
|
|
|
|
**Extends React.Component**
|
|
|
|
FavouriteBar renders favourites. FavouriteBar displays the first two favourites, the rest are shown in a list.
|
|
|
|
### Parameters
|
|
|
|
- `props`
|
|
|
|
### Examples
|
|
|
|
```javascript
|
|
<FavouriteBar
|
|
favourites={favourites}
|
|
onClickFavourite={onClickFavourite}
|
|
onAddPlace={this.addPlace}
|
|
onAddHome={this.addHome}
|
|
onAddWork={this.addWork}
|
|
lang={this.props.lang}
|
|
isLoading={this.props.isLoading}
|
|
/>
|
|
```
|
|
|
|
## favourites
|
|
|
|
Required. Array of favourites, favourite object contains following properties.
|
|
|
|
Type: [Array][1]<[object][2]>
|
|
|
|
### Properties
|
|
|
|
- `address` **[string][3]**
|
|
- `gtfsId` **[string][3]**
|
|
- `gid` **[string][3]**
|
|
- `lat` **[number][4]**
|
|
- `lon` **[number][4]**
|
|
- `name` **[string][3]**
|
|
- `selectedIconId` **[string][3]**
|
|
- `favouriteId` **[string][3]**
|
|
|
|
## onClickFavourite
|
|
|
|
Optional. Function for clicking favourites.
|
|
|
|
## onAddPlace
|
|
|
|
Optional. Function for selecting "Add place" from suggestions.
|
|
|
|
## onEdit
|
|
|
|
Optional. Function for selected "Edit" from suggestions.
|
|
|
|
## onAddHome
|
|
|
|
Optional. Function for "Add home" button.
|
|
|
|
## onAddWork
|
|
|
|
Optional. Function for "Add work" button.
|
|
|
|
## lang
|
|
|
|
Optional. Language, fi, en or sv.
|
|
|
|
## isLoading
|
|
|
|
Optional. Whether to show loading animation, true or false.
|
|
|
|
## color
|
|
|
|
Optional. Default value is '#007ac9'.
|
|
|
|
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
|
|
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
|
|
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
|
|
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
|
|
<!-- This file is automatically generated. Please don't edit it directly:
|
|
if you find an error, edit the source file (likely index.js), and re-run
|
|
./scripts/generate-readmes in the digitransit-component project. -->
|
|
|
|
---
|
|
|
|
This module is part of the Digitransit-ui project. It is maintained in the
|
|
[HSLdevcom/digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) repository, where you can create
|
|
PRs and issues.
|
|
|
|
### Installation
|
|
|
|
Install this module individually:
|
|
|
|
```sh
|
|
$ npm install @digitransit-component/digitransit-component-favourite-bar
|
|
```
|
|
|
|
Or install the digitransit-component module that includes it as a class:
|
|
|
|
```sh
|
|
$ npm install @digitransit-component/digitransit-component
|
|
```
|