0.2.2 • Published 7 years ago

react-launch-progress v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

React Launch Timeline

Inspired by SpaceX's clean display for event sequences.

PeerDependencies Dependencies DevDependencies

Github Page

Prerequisites

You should be using NodeJS and ReactJS

Installation

React Launch Timeline is available as an npm package.

npm install react-launch-timeline [-S]

or

yarn add react-launch-timeline

Usage

Using React Launch Timeline is very straightforward. Once it is included in your project, you can use the components this way:

import React from 'react';
import Timeline from 'react-launch-timeline';

let dates = [
  {
    name: 'Prep',
    date: '2017-04-23',
    onComplete: () => { console.log("Prep is done!"); }
  },
  {
    name: 'Startup',
    date: '2017-04-24',
    onComplete: () => { console.log("Startup is done!"); }
  },
  {
    name: 'Launch',
    date: '2017-04-25',
    onComplete: () => { console.log("Launch is done!"); }
  },
  ...
];

const MyAwesomeReactComponent = () => (
  <Timeline data={dates} />
);

export default MyAwesomeReactComponent;

Customization

KeyRequiredTypeDescription
dataYObject[]Objects with date key and name for labels.
heightYInteger/StringThis will set the total height of the chart.
widthInteger/StringThis will set override the width of the chart.
titleStringTitle of the chart.
labelPosEnum'top', 'bottom', 'alternate-top', 'alternate-bot' This will set the total height of the chart.
xDataStringOptional override date key for data objects.
onCompleteFunctionFunction to call when timeline reaches end.
utcBoolSets parse format to UTC
timedBoolSets progress to d3-timer
mainBkgStringBackground color for main chart area
titleBkgStringBackground color for title
titleStyleObjectStyle for title text (SVG Text).
dotStyleObjectStyle for dots (SVG Circles).
dotCompleteStyleObjectStyle for dots that have been passed/completed.
goalDotStyleObjectStyle for goal Dot.
goalCompleteDotStyleObjectStyle for goal Dot when reached.
progressStyleObjectStyle for progress bar (SVG rect)
styleObjectStyle that is passed to Chart (div).
wrapStyleObjectStyle for wrapper div (div).