{"id":15193616,"url":"https://github.com/hfagerlund/elections-carousel-component","last_synced_at":"2026-03-03T21:01:47.268Z","repository":{"id":64181817,"uuid":"126123535","full_name":"hfagerlund/elections-carousel-component","owner":"hfagerlund","description":"API-based React carousel component (demo)","archived":false,"fork":false,"pushed_at":"2025-01-23T21:54:16.000Z","size":1141,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T04:24:37.380Z","etag":null,"topics":["babel","enzyme","es6","jest","react","react-components","sass","webpack2"],"latest_commit_sha":null,"homepage":"https://hfagerlund.github.io/elections-carousel-component/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hfagerlund.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-21T04:32:40.000Z","updated_at":"2025-01-23T21:53:53.000Z","dependencies_parsed_at":"2025-03-01T04:33:37.317Z","dependency_job_id":null,"html_url":"https://github.com/hfagerlund/elections-carousel-component","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/hfagerlund/elections-carousel-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Felections-carousel-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Felections-carousel-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Felections-carousel-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Felections-carousel-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hfagerlund","download_url":"https://codeload.github.com/hfagerlund/elections-carousel-component/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfagerlund%2Felections-carousel-component/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30060631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","enzyme","es6","jest","react","react-components","sass","webpack2"],"created_at":"2024-09-27T22:01:51.414Z","updated_at":"2026-03-03T21:01:47.253Z","avatar_url":"https://github.com/hfagerlund.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elections-carousel-component\n\n[![Build Status](https://travis-ci.org/hfagerlund/elections-carousel-component.svg?branch=master)](https://travis-ci.org/hfagerlund/elections-carousel-component) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/131b247182a34ba8aa9cf64230e4b470)](https://app.codacy.com/gh/hfagerlund/elections-carousel-component?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=hfagerlund/elections-carousel-component\u0026utm_campaign=Badge_Grade) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\nA component-based carousel presentation of election results data from an external (JSON) API using pure [React](https://github.com/facebook/react).\n\nEnables scrolling through the election results for all ridings using the Next and Back controls (via mouse or keyboard), displaying the number of votes and automatically calculating the percentage of the vote won by each candidate in each riding.\n\nResults data is automatically checked for updates every 5 minutes (by [default](https://github.com/hfagerlund/elections-carousel-component#customizable-options)).\n\n\u003cimg style=\"max-width:100%;\" alt=\"Screenshot of elections-carousel-component on a page\" src=\"/screenshots/screenshot_elections-html.png\" align=\"center\" /\u003e\u003cbr /\u003e\n*Figure 1: screenshot of elections.html page*\n\n- - -\n\n## Demo\n\nAvailable at: https://hfagerlund.github.io/elections-carousel-component/\n\n- - -\n\n## Quick start\n\n```console\n# clone the repo\n$ git clone https://github.com/hfagerlund/elections-carousel-component.git\n\n# install dependencies\n$ yarn\n\n# launch local server (for data feed)\n$ http-server\n\n## browse to http://127.0.0.1:8080/elections.html\n\n```\n\n- - -\n\n## Usage\n### Customizable Options\nThe following props can be set on the `App` component in order to customize it:\n\n| Prop | Type\u003cbr\u003e\u003ca id=\"default\" name=\"default\"\u003e(Default value) | Description |\n| --- | --- | --- |\n| **componentTitle** | `string`\u003cbr\u003e*default value:* `Election Results` | Main `\u003ch1\u003e` heading/title text (in the `\u003cApp /\u003e` component) |\n| **resultUpdatesEnabled** | `bool`\u003cbr\u003e*default value:* `true` | Set to `true`|`false` to enable|disable automatic data updates from the (JSON) feed. |\n| **updatesDisabledMessage** | `string`\u003cbr\u003e*default value:* `Final results reported. All polls are now closed.` | Text displayed in the updates status 'bubble' (ie. directly following the `\u003ch1\u003e` heading) when automatic data updates from the (JSON) feed are disabled. |\n| **updateIntervalInMilliseconds** | `integer`\u003cbr\u003e*default value:* `300000` (ie. 5 mins.) | Time intervals (in msec) at which the (JSON) feed is checked for data updates |\n| **url** | `string`\u003cbr\u003e*default value:* `http://127.0.0.1:8080/src/assets/fixtures/results.js?callback=` | The URL for the (JSON) data feed |\n\n### Examples\n\n**Example 1** - To display a (custom) title of '2011 Election Results', with the (default) status message 'Final results reported. All polls are now closed.', modify `/src/js/elections/index.jsx` as shown below:\n\n**index.jsx** -\n```\nimport React from 'react';\nimport { render } from 'react-dom';\n\nimport App from './components/App.jsx';\n\nrender(\n  \u003cApp\n    componentTitle=\"2011 Election Results\"\n    resultUpdatesEnabled={false}\n  /\u003e,\n  document.getElementById('app')\n);\n```\n\n**Example 2** - Update data results at 3 minute intervals (instead of the default 5 mins.):\n\n**index.jsx** -\n```\n// ...\n\nrender(\u003cApp updateIntervalInMilliseconds={180000} /\u003e, document.getElementById('app'));\n```\n\n**Example 3** - Use all default settings:\n\n**[index.jsx](https://github.com/hfagerlund/elections-carousel-component/blob/master/src/js/elections/index.jsx)** -\n```\n// ...\n\nrender(\u003cApp /\u003e, document.getElementById('app'));\n```\n- - -\n\n## Running the Build\n\nFor a **development** environment:\n\n```\n$ yarn run dev\n\n```\n\nFor a **production** environment:\n\n```\n$ yarn run build:production\n\n```\n\n- - -\n## Running the Unit Tests\n\nRun all tests:\n\n```\n$ yarn run test\n\n```\n\n- - -\n## License\nCopyright (c) 2018 Heini Fagerlund. Licensed under the [BSD-3-Clause license](https://github.com/hfagerlund/elections-carousel-component/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhfagerlund%2Felections-carousel-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhfagerlund%2Felections-carousel-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhfagerlund%2Felections-carousel-component/lists"}