Socket
Socket
Sign inDemoInstall

react-image-timeline

Package Overview
Dependencies
5
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-image-timeline

react-image-timeline


Version published
Weekly downloads
570
increased by26.11%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

#React Image Timeline

An image-centric timeline component for React.js. View chronological events in a pleasant way.

####Features

  • Responsive & mobile-friendly
  • Easily customized
  • Gracefully handles overflow and non-uniform content
  • Lightweight (only CSS and SVG)

####View Example http://aaron9000.github.io/react-image-timeline/

####Add to Existing Project

  • npm install moment --save if needed
  • npm install ramda --save if needed
  • npm install react-image-timeline --save

####Usage

import ReactDOM from 'react-dom';
import Timeline from 'react-image-timeline';
const events = require('events.json'); // See sample data below

ReactDOM.render(<Timeline events={events} />, document.getElementById('root'));

Sample Data

####Props

  • events: array (required)
    • date: date (required)
    • title: string (required)
    • imageUrl: string (required)
    • text: string (required)
    • onClick: function
    • buttonText: string
    • extras: object
  • reverseOrder: boolean
  • customStartLabel: component
  • customEndLabel: component
  • customHeader: component
  • customImageBody: component
  • customTextBody: component
  • customFooter: component

####Custom Event Data To pass extra data into custom components, use the extras field on the event model.

####Custom Styles To customize the timeline styles, add CSS to override timeline.css.

####Custom Dot Pattern The dots are defined in CSS using a base64-encoded image. Encode a new image and override the corresponding CSS class.

####Custom Components For more advanced customization, you can pass in custom components to replace the defaults. Custom components will be passed an event model in props.


// A custom header to replace the default
const CustomHeader = (props) => {

    // The corresponding "event" model
    const {title, extras} = props.event;
    
    // Custom data payload
    const {customField} = extras;

    // Use your own CSS
    return <div className="custom-header">
        <h1>{title}</h1>
        <p>{customField}</p>
    </div>;
};

ReactDOM.render(<Timeline events={events} customHeader={CustomHeader}/>, document.getElementById('root'));

####Run Example Project

npm install
npm run example

Then, visit localhost:3000/example in your browser.

####Run Tests

npm run test

####Screenshot screenshot

Keywords

FAQs

Last updated on 06 Sep 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc