Coder Social home page Coder Social logo

jsainsburyplc / react-timelines Goto Github PK

View Code? Open in Web Editor NEW
252.0 84.0 118.0 2.72 MB

React Timelines Library

Home Page: https://jsainsburyplc.github.io/react-timelines/

License: MIT License

JavaScript 85.72% CSS 14.28%
react library luna sass scss timeline gantt visualization

react-timelines's Introduction

React Timelines

Demo

Install

# with npm
npm install react-timelines

# or with Yarn
yarn add react-timelines

Use

import Timeline from 'react-timelines'

const MyWidget = () => <Timeline {...props} />

export default MyWidget

Styling

Using Webpack

Using Webpack with CSS loader, add the following:

import 'react-timelines/lib/css/style.css'

Using Sass (SCSS)

Using Sass you can configure the timeline with variables:

$react-timelines-font-family: MaryAnn;
$react-timelines-sidebar-width: 320px;

@import '~/react-timelines/src/scss/style';

Without build tools

Create a CSS file with the contents of react-timelines/lib/css/style.css and include it in <head>

Development

npm install
npm run watch

This library is developed using VSCode - opening it in VSCode will recommend extensions, and enable linting and auto-formatting of code.

react-timelines's People

Contributors

atkinchris avatar dependabot[bot] avatar rbrtsmith avatar willbamford avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-timelines's Issues

TypeScript Support

Rewriting this library in TypeScript would help it remain bug free and easier for new maintainers, and bring it closer to other products.

Stretch-to-fill container

Currently if the end date isn't far enough future (for given scale) the timeline is displayed shorter than parent. We could stretch to fill space (would also have to listen to debounced window resize event).

Tracker tearing when scrolling

Since the addition of the sticky header a rendering issue has surfaced when scrolling - it appears as though the paint is tearing.

Localization

Hello! Is it possible to somehow translate months into another language? I changed title property in month cell on my language but I still see English titles then I put my mouse in top of the timeline.

image

Thank you for this lib, it's cool!

Upgrade Demo build tools

The demo currently uses Webpack 3 and has audit problems. It's build tooling should be upgraded.

Feature/Help needed: Hide specific columns

I'm using this to create a timeline based on weeks and days:

image

I used the following code to create the cells:

export const buildWeekCells = () => {
  const v = []
  for (let i = 0; i < 52; i += 1) {
    const week = moment().startOf('year').weekday(1).add(i, 'week')

    v.push({
      id: `w${i}`,
      title: `W${i}`,
      start: week.toDate(),
      end: week.add(1, 'week').subtract(2, 'day').toDate(),
    })
  }

  return v
}

export const buildDayCells = () => {
  const v = []
  for (let i = 0; i < 365; i += 1) {
    const day = moment().startOf('year').weekday(7).add(i, 'day')

    if (day.weekday() !== 6 && day.weekday() !== 0) {
      v.push({
        id: `d${i}`,
        title: day.toString()[0],
        start: day.toDate(),
        end: day.add(1, 'day').toDate(),
      })
    }
  }

  return v
}

I couldn't find a way to hide specific columns (in my case the weekends). This could be very useful. Any ideas on how to implement this?

Demo link

Please have a demo page so we can see without having to clone

Accessibility

I'm not sure how accessible React Timelines is currently. Let's find out and fix as many issues as we can...

Unable to run demo locally

Hi, I am trying to run the demo locally with npm. For some reason the page does not load.
Any idea why it won't work?

Add class name prefixes to fix potential style leaks

As it currently stands we are not prefixing our classNames e.g. we have .sidebar
which means consumers CSS is likely to leak into the timeline.

I suggest we prefix all our classNames with rt- to avoid this.

Question/ Data handling

Great repo!

Quick question, does the data get sent to any server or everything handled in the browser?

Thank you..

Needs Documentation

Really cool this is built! Thank you.

Is it possible to get some very basic documentation. The demo helps at least :)

Feature: Pass css classes to Grid Cells

Currently the project allows a developer to pass css classes to Timeline Elements via the 'classes' property of elements. This capability should be extended the grid cells as well for the use case of shading weekends / holidays.

Use context to pass click* handlers to tracks and elements

To bring click handlers to Elements and Tracks, these are passed in at the top level as clickElement and (the proposed) clickTrack. These are then manually passed through each layer, till they reach the Elements and Tracks.

It could be more appropriate to use context to get these to the intended nested components, without having to pass them through each intermediary.

Proposal raised in #68

Feature Request: Override Marker Labels

Hey, this looks like a cool library, thanks for sharing.

I'm looking for a way to pass a prop to Timeline that would allow for changing the formatting for the label of the NowMarker and the PointerMarker components.

Is this something you'd consider adding?

Cheers

Improve Docs

We need to document the API. Will do this following the demo.

Migrate from CircleCI to GitHub Actions

We no longer use CircleCI as part of our standard tooling. We should migrate this library's testing and build pipeline to GitHub Actions, to colocate it with the repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.