NOTE: This repository is no longer maintained and has been archived. The project has been moved to a new repository: elections-carousel-component.


Usage

Adding to a page:

Refer to the included elections.html for an example page.

<div class="ec ec-results">

(Shown here applied to a div, but may be applied to any element - for example: article or whatever is semantically required.)

<link href="<path-to-your-page>/dist/css/main-<dynamic-bundle-hash>.css" media="all" rel="stylesheet" type="text/css" />

making the appropriate modifications to the 'path-to-your-page' and 'dynamic-bundle-hash' values.

<script src="<path-to-your-page>/dist/js/main-<dynamic-bundle-hash>.js"></script>

making the appropriate modifications to the 'path-to-your-page' and 'dynamic-bundle-hash' values.

var ecarousel = require('./elections-carousel');
ecarousel.init({});

Running the build:

Automatic bundle hash updates:

Running the build ($ yarn run build:production) will automatically update both the CSS and JavaScript bundle hashes on the (included) elections.html page.

Edit get-bundle-hash.sh to change the page to 'your-custom-page-name.html'.

Keyboard support:

To use the carousel controls via the keyboard:

Running the Unit Tests

On the command line:

Run all (Tape) tests, and read the results, on the command line using the following:

$ yarn run test

Generate (Istanbul) code coverage reports using:

$ yarn run coverage

In the browser:

View (Istanbul) code coverage results in the browser at:

http://127.0.0.1:8080/coverage/lcov-report/