Alert people to recent thefts! Add a convenient way to search for stolen bikes right on your page.
All you need to do is include this HTML snippet where you would like the widget to appear:
<div id="binx-stolen-widget"></div>
And add this to the header of your page:
<script src="https://widget.bikeindex.org/stolen-widget.js"></script>
A few options for customization and configuration:
property | what it does | default |
---|---|---|
location |
Find stolen bikes near this location first (address, city, state or lat/long) | Shows recent for |
height |
max-height for the widget in pixels | 400px |
recentResults |
Boolean - whether or not it should fetch recent stolen bikes (it starts just as a search widget) | true |
cacheResults |
Store recent results for three hours in localstorage | true |
elementId |
the id of the div element for the widget | binx-stolen-widget |
Set the options when configuring the widget within the script tag:
<!-- Override default options -->
<script>
BikeIndexWidget.init({
height: 400,
cacheResults: true,
recentResults: true,
location: 'Portland, OR',
elementId: 'some-other-id',
});
</script>
<!-- No options -->
<script>
BikeIndexWidget.init();
</script>
- Install dependencies
yarn
- Start webpack server in development mode
yarn start
- This should open the widget in your browser here
- Run the script to lint and run the jest specs:
yarn test
// OR
yarn watch
Made with all the 🍩s. Bike Index