1.0.4 • Published 4 years ago

react-events-timeline v1.0.4

Weekly downloads
46
License
MIT
Repository
github
Last release
4 years ago

react-events-timeline

Version Build Coverage Minified size Downloads Dependabot PRs Welcome Tested with jest

Table of contents

Installation

You need to install package:

npm install react-events-timeline

You can use yarn:

yarn add react-events-timeline

Getting started

You should import the component and css file:

import EventsTimeline from 'react-events-timeline';
import 'react-events-timeline/dist/main.css';

Then use the component in your application. For example:

<EventsTimeline title='HISTORY' icon={icon} color='blue' data={data} />

The settings of the component

ParameterRequiredTypeDescriptionDefault
coloroptionalstringThe component supports 3 color versions blue, green and orangecolor: '#333'
iconoptionaljsxYou can present the icon in any form as a JSX. For example, using an icon font such as font-awesome: <i className='fa fa-briefcase'/>By default the icon will not be displayed with the title
titleoptionalstringSets the name of the timeline next to the iconBy default the title will not be displayed
datarequiredarraySee the description of Data item parameters

Data item parameters

Data is an array containing objects. For example:

const data = [
{
    date: 2019,
    title: 'Senior Developer',
    label: 'GitHub',
    location: 'Palo Alto, California (USA)',
    content: (<div>
      Description
    </div>),
},
...OtherObjects
]
ParameterRequiredTypeDescription
daterequiredstringDate for item output. It can be YYYY,MM.YY,DD.MM or any other configuration.
contentrequiredjsxYour content for item
titleoptionalstringThe title of the item
labeloptionalstringLabel is the text that will be highlighted in color
locationoptionalstringLocation designation

Example

import EventsTimeline from 'react-events-timeline';
import 'react-events-timeline/dist/main.css';

const data = [
{
    date: 2019,
    title: 'Senior Developer',
    label: 'GitHub',
    location: 'Palo Alto, California (USA)',
    content: (<div>Description</div>),
}];
const icon = <i className='fa fa-briefcase'/>;

const App = () => (
  <div className="app">
    ...
    <EventsTimeline title='WORK HISTORY' icon={icon} color='blue' data={data} />
  </div>
);
export default App;