├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── __tests__ ├── components │ ├── ItineraryHost.spec.tsx │ ├── ItineraryItem.spec.tsx │ ├── ItineraryProvider.spec.tsx │ └── index.spec.ts ├── index.spec.ts └── tsconfig.json ├── docs ├── advanced.html ├── advanced.tsx ├── dist │ ├── advanced.bundle.js │ ├── simple.bundle.js │ └── vendor.bundle.js ├── index.html ├── simple.html ├── simple.tsx └── tsconfig.json ├── lib ├── components │ ├── ItineraryHost.d.ts │ ├── ItineraryHost.js │ ├── ItineraryHost.js.map │ ├── ItineraryItem.d.ts │ ├── ItineraryItem.js │ ├── ItineraryItem.js.map │ ├── ItineraryProvider.d.ts │ ├── ItineraryProvider.js │ ├── ItineraryProvider.js.map │ ├── index.d.ts │ ├── index.js │ └── index.js.map ├── index.d.ts ├── index.js └── index.js.map ├── package.json ├── src ├── components │ ├── ItineraryHost.ts │ ├── ItineraryItem.ts │ ├── ItineraryProvider.ts │ └── index.ts └── index.ts ├── tsconfig.json └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Package lockfiles 40 | package-lock.json 41 | 42 | # Typescript v1 declaration files 43 | typings/ 44 | 45 | # Optional npm cache directory 46 | .npm 47 | 48 | # Optional eslint cache 49 | .eslintcache 50 | 51 | # Optional REPL history 52 | .node_repl_history 53 | 54 | # Output of 'npm pack' 55 | *.tgz 56 | 57 | # Yarn Integrity file 58 | .yarn-integrity 59 | 60 | # dotenv environment variables file 61 | .env 62 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "lts/*" 4 | after_success: 5 | - npm run coverage:upload -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-itinerary 2 | > Render react components based on time sequences such as video or audio files. 3 | 4 | [![Build Status](https://travis-ci.org/zachrip/react-itinerary.svg?branch=master)](https://travis-ci.org/zachrip/react-itinerary) 5 | [![Coverage Status](https://coveralls.io/repos/github/zachrip/react-itinerary/badge.svg)](https://coveralls.io/github/zachrip/react-itinerary) 6 | ### Why 7 | Sometimes you want to render certain things based on the current time of a video or music file. 8 | 9 | ### Installation 10 | ``` 11 | npm install react-itinerary 12 | ``` 13 | 14 | ### Example [more here](https://zachrip.github.io/react-itinerary/) 15 | This example will change the itinerary item text color when the current video playhead is between 5 and 10 seconds 16 | ```javascript 17 | import { ItineraryProvider, ItineraryHost, ItineraryItem } from 'react-itinerary'; 18 | const App = () => ( 19 | 20 |
21 | ( 24 |
42 |
43 | ); 44 | ``` 45 | 46 | ### Docs (WIP) 47 | | Component | props | 48 | |-------------------|----------------------------------------------------------------------------------------------------------------| 49 | | ItineraryProvider | n/a | 50 | | ItineraryHost | id: string; render: function; | 51 | | ItineraryItem | id: string; render?: function; onActivated?: function; onDeactivated?: function; end?: number; start?: number; | -------------------------------------------------------------------------------- /__tests__/components/ItineraryHost.spec.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { mount } from 'enzyme'; 3 | 4 | import ItineraryHost from '../../src/components/ItineraryHost'; 5 | 6 | describe('Itinerary Host', () => { 7 | it('should render children', () => { 8 | const node = mount( 9 | ( 12 |