Git Product home page Git Product logo

prabhuignoto / react-chrono Goto Github PK

View Code? Open in Web Editor NEW
3.8K 3.8K 199.0 232.88 MB

🕑 Modern Timeline Component for React

Home Page: https://react-chrono.prabhumurthy.com

License: MIT License

HTML 27.58% CSS 0.19% TypeScript 61.37% JavaScript 10.71% SCSS 0.15%
horizontal-timeline javascript-timeline react react-timeline reactjs slideshow timeline timeline-component typescript vertical-timeline vertical-timeline-react

react-chrono's Introduction



Build Status DeepScan grade Codacy Badge react-chrono Known Vulnerabilities Depfu npm bundle size styled with Prettier License npm version npm downloads Coverage Status

Features

Table of Contents

⚡ Installation

// install with yarn
yarn add react-chrono

// or with npm
npm install react-chrono

Getting Started

Please make sure you wrap the component in a container that has a width and height.

When no mode is specified, the component defaults to HORIZONTAL mode. Please check props for all the available options.

  import React from "react"
  import { Chrono } from "react-chrono";

  const Home = () => {
    const items = [{
      title: "May 1940",
      cardTitle: "Dunkirk",
      url: "http://www.history.com",
      cardSubtitle:"Men of the British Expeditionary Force (BEF) wade out to..",
      cardDetailedText: "Men of the British Expeditionary Force (BEF) wade out to..",
      media: {
        type: "IMAGE",
        source: {
          url: "http://someurl/image.jpg"
        }
      }
    }, ...];

    return (
      <div style={{ width: "500px", height: "400px" }}>
        <Chrono items={items} />
      </div>
    )
  }

horizontal-all

🚥Vertical Mode

To render the timeline vertically use the VERTICAL mode

<div style={{ width: '500px', height: '950px' }}>
  <Chrono items={items} mode="VERTICAL" />
</div>

vertical-basic

🚥Vertical Alternating

In VERTICAL_ALTERNATING mode the timeline is rendered vertically with cards alternating between left and right side.

<div style={{ width: '500px', height: '950px' }}>
  <Chrono items={items} mode="VERTICAL_ALTERNATING" />
</div>

vertical_alternating

Props

Below are the available configuration options for the component:

Name Default Description
activeItemIndex 0 Selects the active timeline item when loading.
allowDynamicUpdate false Enables or disables dynamic updates of timeline items.
borderLessCards false Removes borders and shadows from the timeline cards.
buttonTexts Customizes the alternative text for all buttons.
cardHeight 200 Defines the minimum height of timeline cards.
cardLess false Disables timeline cards in both horizontal and vertical layouts.
cardPositionHorizontal Positions the card in horizontal mode. Options: TOP or BOTTOM.
cardWidth Sets the maximum width of timeline cards.
classNames Applies custom class names to different card elements.
contentDetailsHeight 150 Controls the height of the details section if using cardDetailedText. Refer to TimelineItem model for more info.
disableAutoScrollOnClick false Prevents auto-scrolling when a timeline card is clicked.
disableClickOnCircle false Disables the click action on circular points.
disableInteraction false Disables all the interactions with the Timeline.
disableNavOnKey false Turns off keyboard navigation.
disableTimelinePoint false Disables the timeline point in both HORIZONTAL and VERTICAL mode.
enableBreakPoint true Automatically switches to vertical mode when the vertical breakpoint is reached.
enableDarkToggle false Adds a toggle switch for dark mode.
enableLayoutSwitch true Switches the timeline layout
enableQuickJump true Allows to quickly jump to a timeline item
flipLayout false Reverses the layout (Right to Left).
focusActiveItemOnLoad false Automatically scrolls to and focuses on the activeItemIndex when loading.
fontSizes Allows customization of font sizes.
highlightCardsOnHover false Highlights the card on hover
items [] A collection of Timeline Item Models.
itemWidth 300 Sets the width of the timeline section in horizontal mode.
lineWidth 3px Adjusts the width of the timeline track line.
mediaHeight 200 Sets the minimum height for media elements like images or videos in the card.
mediaSettings Configures settings specific to media layout. Refer to mediaSettings for more info.
mode VERTICAL_ALTERNATING Sets the component mode. Options: HORIZONTAL, VERTICAL, VERTICAL_ALTERNATING.
nestedCardHeight 150 Defines the height of nested timeline cards.
noUniqueId false Prevents generating a unique id for the table wrapper.
onItemSelected Invokes a callback on item selection, passing relevant data.
onScrollEnd Detects the end of the timeline via onScrollEnd.
onThemeChange Invokes a callback when the theme changes, triggered via enableDarkToggle.
parseDetailsAsHTML false Parses the cardDetailedText as HTML.
responsiveBreakPoint 1024 Break point at which the timeline changes to VERTICAL mode when VERTICAL_ALTERNATING is the default mode
scrollable true Makes the timeline scrollable in VERTICAL and VERTICAL_ALTERNATING modes.
showAllCardsHorizontal false Displays all cards in horizontal mode. By default, only the active card is shown.
slideItemDuration 5000 Sets the duration (in milliseconds) that a timeline card is active during a slideshow.
slideShow false Enables slideshow control.
textDensity HIGH Configures the amount of text to be displayed in each timeline card. Can be either HIGH or LOW
textOverlay false Displays text as an overlay on media elements. Refer to Text Overlay for more info.
theme Customizes colors. Refer to Theme for more info.
timelinePointDimension Defines the dimensions of circular points on the timeline.
timelinePointShape circle Configures the shape of timeline points. Options: circle, square, diamond.
titleDateFormat 'MMM DD, YYYY' Formats the date for each timeline item. Supports all dayjs formats.
toolbarPosition TOP Configures the position of the toolbar. Can be TOP or BOTTOM
uniqueId Used with noUniqueId to set a custom unique id for the wrapper.
useReadMore true Enables or disables the "read more" button. Available if text content on the card is taller than the card itself.
disableToolbar false Disables and hides the toolbar

Mode

react-chrono supports three modes HORIZONTAL, VERTICAL and VERTICAL_ALTERNATING. No additional setting is required.

<Chrono items={items} mode="HORIZONTAL" />
<Chrono items={items} mode="VERTICAL" />
<Chrono items={items} mode="VERTICAL_ALTERNATING" />

Timeline item Model

name description type
cardDetailedText detailed text displayed in the timeline card String or String[]
cardSubtitle text displayed in the timeline card String
cardTitle title that is displayed on the timeline card String
date date to be used in the title. when used, this will override the title property Date
media media object to set image or video Object
timelineContent render custom content instead of text.This prop has higher precedence over cardDetailedText ReactNode
title title of the timeline item String
url url to be used in the title String
{
  title: "May 1940",
  cardTitle: "Dunkirk",
  cardSubtitle:
    "Men of the British Expeditionary Force (BEF) wade out to a destroyer during the evacuation from Dunkirk.",
  cardDetailedText: ["paragraph1", "paragraph2"],
  timelineContent: <div>Custom content</div>,
}

if you have a large text to display(via cardDetailedText) and want to split the text into paragraphs, you can pass an array of strings.

each array entry will be created as a paragraph inside the timeline card.

⌨Keyboard Navigation

The timeline can be navigated via keyboard.

  • For HORIZONTAL mode use your LEFT RIGHT arrow keys for navigation.
  • For VERTICAL or VERTICAL_ALTERNATING mode, the timeline can be navigated via the UP DOWN arrow keys.
  • To easily jump to the first item or the last item in the timeline, use HOME or END keys.

To disable keyboard navigation set disableNavOnKey to true.

<Chrono items={items} disableNavOnKey />

Scrollable

With the scrollable prop, you can enable scrolling on both VERTICAL and VERTICAL_ALTERNATING modes.

<Chrono items={items} scrollable />

The scrollbar is not shown by default. To enable the scrollbar, pass an object with prop scrollbar to scrollable prop.

<Chrono items={items} scrollable={{ scrollbar: true }} />

📺Media

Both images and videos can be embedded in the timeline.

Just add the media attribute to the Timeline Item model and the component will take care of the rest.

To embed a image
{
  title: "May 1940",
  cardTitle: "Dunkirk",
  media: {
    name: "dunkirk beach",
    source: {
      url: "http://someurl/image.jpg"
    },
    type: "IMAGE"
  }
}
To embed a video

Videos start playing automatically when active and will be automatically paused when not active.

Like images, videos are also automatically hidden when not in the visible viewport of the container.

{
  title: "7 December 1941",
  cardTitle: "Pearl Harbor",
  media: {
    source: {
      url: "/pearl-harbor.mp4",
      type: "mp4"
    },
    type: "VIDEO",
    name: "Pearl Harbor"
  }
}

To embed YouTube videos, use the right embed url.

{
  title: "7 December 1941",
  cardTitle: "Pearl Harbor",
  media: {
    source: {
      url: "https://www.youtube.com/embed/f6cz9gtMTeI",
      type: "mp4"
    },
    type: "VIDEO",
    name: "Pearl Harbor"
  }
}

media

Text overlay mode

The textOverlay prop allows you to overlay text on top of a media element in a card.To enable the text overlay feature, simply add the text property to the items array in your Chrono timeline data. Here's an example:

import { Chrono } from 'react-chrono';

const items = [
  {
    title: 'First item',
    media: {
      type: 'IMAGE',
      source: {
        url: 'https://example.com/image.jpg',
      },
    },
    text: 'This is the caption for the first item.',
  },
];

function MyTimeline() {
  return <Chrono items={items} textOverlay />;
}

The user can click on the expand button to expand the text and see more details. Here's what it looks like:

timeline_card_text_overlay

With the textOverlay prop, you can give your timeline a modern and sleek look, and provide additional context or information about each item.

🛠Rendering custom content

The Timeline cards of the component can also support embedded custom content. To insert custom content, pass the blocked elements between the Chrono tags. For instance, the below code snippet will generate two timeline items, where each div element will be automatically converted into a timeline item and inserted into the timeline card. The items collection mentioned in the code is completely optional, and custom rendering is supported on all three modes.

<Chrono mode="VERTICAL">
  <div>
    <p>Lorem Ipsum. Lorem Ipsum. Lorem Ipsum</p>
  </div>
  <div>
    <img src="<url to  a nice image" />
  </div>
</Chrono>

Note that the items collection will also work well with any custom content that is passed. In the following code snippet, the title and cardTitle are set for the custom contents.

const items = [
  { title: 'Timeline title 1', cardTitle: 'Card Title 1' },
  { title: 'Timeline title 2', cardTitle: 'Card Title 2' },
];

<Chrono mode="VERTICAL" items={items}>
  <div>
    <p>Lorem Ipsum. Lorem Ipsum. Lorem Ipsum</p>
  </div>
  <div>
    <img src="<url to  a nice image" />
  </div>
</Chrono>;

🎭Custom icons for the Timeline

To utilize personalized icons on the timeline, enclose a collection of images between the chrono tags, wrapped in a container.

The icons are arranged sequentially; meaning, the first image that you pass in will be used as the icon for the first timeline item, and so on.

It is important to note that the image collection must be passed in inside a container with the designated chrono-icons className. This is a required convention, as the component relies on this className to select the appropriate images.

<Chrono items={items} mode="VERTICAL_ALTERNATING">
  <div className="chrono-icons">
    <img src="image1.svg" alt="image1" />
    <img src="image2.svg" alt="image2" />
  </div>
</Chrono>

custom icons also works if you are rendering custom content inside the cards.

<Chrono mode="VERTICAL" items={items}>
  <div>
    <p>Lorem Ipsum. Lorem Ipsum. Lorem Ipsum</p>
  </div>
  <div>
    <img src="<url to  a nice image" />
  </div>
  <div className="chrono-icons">
    <img src="image1.svg" alt="image1" />
    <img src="image2.svg" alt="image2" />
  </div>
</Chrono>

🌿Nested Timelines

Nested timelines in React-Chrono allow you to display timelines within timeline cards. This feature is data-driven, which means that if a timeline item has an items array, the component will automatically attempt to render the nested timeline inside the timeline card.

To use nested timelines, simply provide an array of items within the items property of a timeline item. The component will then take care of rendering the nested timeline for you.

You can also adjust the height of the nested timeline card using the nestedCardHeight prop. This allows you to control the size of the card to fit your specific use case.

const items = [
  {
    title: 'Timeline title 1',
    cardTitle: 'Card Title 1',
    items: [
      { cardTitle: 'nested card title 1' },
      { cardTitle: 'nested card title 2' },
    ],
  },
  { title: 'Timeline title 2', cardTitle: 'Card Title 2' },
];

<Chrono mode="VERTICAL" items={items}></Chrono>;

Slideshow

Enabling the slideshow feature can be done by setting the slideShow prop to true. Additionally, an optional slideItemDuration prop can be set to determine the time delay between cards.

Enabling this prop will cause the play button to appear in the timeline control panel. Use the slideShowType prop to set the type of slideshow animation.

Mode Default Slideshow Type
VERTICAL reveal
VERTICAL_ALTERNATING slide_from_sides
HORIZONTAL slide_in
<Chrono
  items={items}
  slideShow
  slideItemDuration={4500}
  slideShowType="reveal"
/>

The slideshow can be cancelled by clicking on the stop button in the control panel or by pressing the ESC key.

Item Width

The itemWidth prop can be used to set the width of each individual timeline sections. This setting is applicable only for the HORIZONTAL mode.

🎥Media Settings

Use media settings to align the media or change how a image is displayed in the card.

Name Description Type Default
align aligns the media. can be left, right or center string center
fit fits the image. can be cover or contain string cover
<Chrono items={items} mediaSettings={{ align: 'right', fit: 'contain' }} />

Breakpoint

Use the breakpoint feature to automatically switch the timeline to VERTICAL mode when there is not enough space for VERTICAL_ALTERNATING mode, such as on mobile devices. Set the auto switch to happen by enabling the enableBreakPoint prop and specifying the pixel limit with the verticalBreakPoint prop.

<Chrono items={items} enableBreakPoint verticalBreakPoint={400} />

🎨Theme

Customize colors with the theme prop.

Checkout the documentation for the complete list of available theme properties.

<Chrono
  items={items}
  theme={{
    primary: 'red',
    secondary: 'blue',
    cardBgColor: 'yellow',
    titleColor: 'black',
    titleColorActive: 'red',
  }}
/>

Customize Font sizes

Use the fontSizes prop to customize the font sizes of the timeline card.

<Chrono
  items={data}
  mode="HORIZONTAL"
  fontSizes={{
    cardSubtitle: '0.85rem',
    cardText: '0.8rem',
    cardTitle: '1rem',
    title: '1rem',
  }}
></Chrono>

Customize alt text for buttons

With the buttonTexts prop, you can change the button's alt text.

<Chrono
  items={data}
  mode="HORIZONTAL"
  buttonTexts={{
    first: 'Jump to First',
    last: 'Jump to Last',
    next: 'Next',
    previous: 'Previous',
  }}
></Chrono>

Defaults

Property Value
first 'Go to First'
last 'Go to Last'
next 'Next'
play 'Play Slideshow'
previous 'Previous'

Using custom class names

You can use the classNames prop to employ your own class names. The subsequent example illustrates how you can use custom class names on different elements.

<Chrono
  className="my-timeline"
  items={items}
  classNames={{
    card: 'my-card',
    cardMedia: 'my-card-media',
    cardSubTitle: 'my-card-subtitle',
    cardText: 'my-card-text',
    cardTitle: 'my-card-title',
    controls: 'my-controls',
    title: 'my-title',
  }}
/>

📦CodeSandbox Examples

Kitchen Sink

📚Storybook

Deep dive into wide variety of examples hosted as a Storybook.

🔨Build Setup

# install dependencies
pnpm install

# start dev
pnpm dev

# run css linting
pnpm lint:css

# eslint
pnpm eslint

# prettier
pnpm lint

# package lib
pnpm rollup

🧪Tests

  # run unit tests
  pnpm test

  # run cypress tests
  pnpm cypress:test

  # run cypress tests in headless mode
  pnpm cypress:headless

  # run cypress tests in quiet mode
  pnpm cypress:quiet

🤝Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b new-feature)
  3. Commit your changes (git commit -am 'Add feature')
  4. Push to the branch (git push origin new-feature)
  5. Create a new Pull Request

🧱Built with

Meta

Huge thanks to BrowserStack for the Open Source License!

Distributed under the MIT license. See LICENSE for more information.

Prabhu Murthy – @prabhumurthy2[email protected] https://github.com/prabhuignoto

Buy Me A Coffee

sonar

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Alois
Alois

📖
Koji
Koji

📖
Alexandre Girard
Alexandre Girard

💻
Ryuya
Ryuya

📖
Taqi Abbas
Taqi Abbas

💻
megasoft78
megasoft78

💻
Eric(书生)
Eric(书生)

💻
Christophe Bernard
Christophe Bernard

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

react-chrono's People

Contributors

3ru avatar allcontributors[bot] avatar aloisdg avatar alx avatar bigbigdreamer avatar deepsourcebot avatar drakexorn avatar hungthinhit avatar imgbot[bot] avatar imgbotapp avatar koji avatar nkhunters avatar prabhuignoto avatar taqi457 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

react-chrono's Issues

[DepShield] (CVSS 5.3) Vulnerability due to usage of kind-of:3.2.2

Vulnerabilities

DepShield reports that this application's usage of kind-of:3.2.2 results in the following vulnerability(s):


Occurrences

kind-of:3.2.2 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ @svgr/webpack:4.3.3
              └─ @svgr/plugin-svgo:4.3.1
                    └─ merge-deep:3.0.2
                          └─ clone-deep:0.2.4
                                └─ kind-of:3.2.2
                          └─ kind-of:3.2.2
        └─ webpack:4.41.5
              └─ micromatch:3.1.10
                    └─ braces:2.3.2
                          └─ fill-range:4.0.0
                                └─ is-number:3.0.0
                                      └─ kind-of:3.2.2
                          └─ snapdragon-node:2.1.1
                                └─ snapdragon-util:3.0.1
                                      └─ kind-of:3.2.2
                    └─ snapdragon:0.8.2
                          └─ base:0.11.2
                                └─ cache-base:1.0.1
                                      └─ to-object-path:0.3.0
                                            └─ kind-of:3.2.2
                                └─ class-utils:0.3.6
                                      └─ static-extend:0.1.2
                                            └─ object-copy:0.1.0
                                                  └─ kind-of:3.2.2
                          └─ define-property:0.2.5
                                └─ is-descriptor:0.1.6
                                      └─ is-accessor-descriptor:0.1.6
                                            └─ kind-of:3.2.2
                                      └─ is-data-descriptor:0.1.4
                                            └─ kind-of:3.2.2

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Titles are mispositioned.

Hi.
The titles of the timeline are mispositioned. They should be on top of the blue circles but right now they are on the line. I can position the titles using styling(I don't want to do that because of variable length of the titles), but out of the box they are like this
image

Here is the link to my repository:
https://github.com/naajil-aamir/Timeline.git

cardHeight prop not working

Describe the bug
I am adding cardHeight property to the Chrono component but nothing changes with the cards

To Reproduce
Steps to reproduce the behavior:

  1. Add "cardHeight" to Chromo component

Expected behavior
From what I understand, the cardHeight property makes all cards have a certain minimum height. For example if I set it 1000, then all cards will have a minimum of 1000 pixels in height. However, in my case, the cards have the minimum height they need based on the text they occupy not the value I give.

Screenshots
https://imgur.com/a/PHGelk4

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: PC
  • OS: Windows 10
  • Browser: Firefox
  • Version: 1.8.4

cardHeight prop is not working in VERTICAL mode

Describe the bug
I am adding cardHeight property to the Chrono component having Vertical mode but nothing changes with the cards.

To Reproduce
Steps to reproduce the behavior:

  1. Clone vertical basic sandbox example given on npm website (https://codesandbox.io/s/react-chrono-vertical-basic-0rm1o?file=/src/App.js)
  2. Add "cardHeight" to Chrono component

Expected behavior
From what I understand, the cardHeight property makes all cards have a certain minimum height. For example if I set it 700, then all cards will have a minimum of 700 pixels in height. However, in my case, the cards have the minimum height of 200.

Screenshots
https://codesandbox.io/s/ug6h3

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version: 89.0.4389.82

Image not showing up

Describe the bug
Despite following the instruction in README closely, images I link in the media attributes are not showing up in the timeline element at all. Below is how my code looks like.

        title: "May 1940",
        cardTitle: "Project 1",
        cardSubtitle:"Description of my amazing project",
        cardDetailedText: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
        media: {
          source: {
            url: "https://cdn.the-scientist.com/assets/articleNo/66820/hImg/34886/bird-banner3-l.png",
            type:"png"
          },
          type: "IMAGE"
        }
      },

Expected behavior
Image shows up in the timeline card

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome

Thanks in advance!

Scrolling within timeline element description is unreliable

Is your feature request related to a problem? Please describe.
A user should be able to explore both timeline and its elements seamlessly on mobile phone. Currently, it is very easy to scroll entire timeline and hard to scroll timeline element description.

Describe the solution you'd like
Scroll detection in timeline element should be more aggressive. Even if it would collide with normal timeline scrolling, the result would be less bothersome than trying to scroll element description and the accidentally scrolling entire timeline.
Through experience a user could easily learn to scroll entire timeline using parts of screen not reserved for element scrolls.

Describe alternatives you've considered

  • creating small descriptions so they don't have to be scrolled to be seen completely
  • replacing scroll with buttons that are easier to press, since element descriptions usually do not contain so much text to call for precise scroll widget.

[DepShield] (CVSS 5.3) Vulnerability due to usage of kind-of:4.0.0

Vulnerabilities

DepShield reports that this application's usage of kind-of:4.0.0 results in the following vulnerability(s):


Occurrences

kind-of:4.0.0 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ webpack:4.41.5
              └─ micromatch:3.1.10
                    └─ snapdragon:0.8.2
                          └─ base:0.11.2
                                └─ cache-base:1.0.1
                                      └─ has-value:1.0.0
                                            └─ has-values:1.0.0
                                                  └─ kind-of:4.0.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Divide the detailed text in paragraphs

Hi Prabhu! Have you thought of transforming "cardDetailedText" in an object where you can order your info like:

cardDetailedText:{
paragraph1: lorempisum....,
paragraph2: new paragraph...
.
.
}

The library is really cool.

Cards missing in horizontal timeline in Gatsby production build

Describe the bug
When I run my gatsby app in development by using "yarn start" then the horizontal timeline works perfectly. However, if I want to publish a build by using "yarn build" then the cards of the timeline all disappear. I have included a link to relevant images below.

To Reproduce
Steps to reproduce the behavior:

  1. Create a timeline with horizontal mode
  2. Run "gatsby build" / "yarn build" / "npm build"
  3. All cards will be missing from the timeline

Expected behavior
It is expected that all the cards appear normally just like in the development Gatsby build when running "yarn start." The issue only occurs when the final build is made by using "yarn build"

Screenshots
https://imgur.com/a/VPdVDBs

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox
  • Version: 1.8.4

Smartphone (please complete the following information):

  • Device: Samsung S10
  • OS: Android 10
  • Browser: Chrome
  • Version: 1.8.4

The device is not very relevant for this issue. It has to do with the final production build that Gatsby outputs. Since the production build Gatsby generates is "more optimized," I believe something gets messed up in that process since it doesn't happen in the development build.

UPDATE: This issue only happens in the index page of the website when visited for the first time. For example, let's say the timeline is in the index page which I first land on. The cards in the horizontal line will not appear. If I go to another page then back to the index page, the timeline works as expected and the cards are there.
I hope this could help narrow down the bug.

Adding small images/icons to the clickable circles on the timeline

Is your feature request related to a problem? Please describe.
This is just a suggestion for the visual aspect of the timeline. Adding icons to the clickable circles of the timeline would be more visually appealing and convey some message while viewing the timeline and prior to clicking on the next event.

Describe the solution you'd like
A prop inside the objects in the items array for an icon/image.
This could simply add to the "style" of the circle div the property "background" which links to the link of the given icon. Preferably, a better solution would be to allow the addition of a div component (placed on top of the circle but still inside the circle borders), enabling greater customization.

Describe alternatives you've considered
I have tried looking into the files of the library but I couldn't find the div relating to the circles

Scroll support

currently the timelines can be navigated only via keyboard and ui controls. it will be nice to navigate the timeline via mouse scroll.
#58

[DepShield] (CVSS 7.5) Vulnerability due to usage of debug:2.6.9

Vulnerabilities

DepShield reports that this application's usage of debug:2.6.9 results in the following vulnerability(s):


Occurrences

debug:2.6.9 is a transitive dependency introduced by the following direct dependency(s):

babel-core:6.26.3
        └─ debug:2.6.9
        └─ babel-traverse:6.26.0
              └─ debug:2.6.9

react-scripts:3.4.0
        └─ eslint-plugin-import:2.20.0
              └─ eslint-import-resolver-node:0.3.4
                    └─ debug:2.6.9
              └─ eslint-module-utils:2.6.0
                    └─ debug:2.6.9
              └─ debug:2.6.9
        └─ react-dev-utils:10.2.1
              └─ detect-port-alt:1.1.6
                    └─ debug:2.6.9
        └─ webpack:4.41.5
              └─ micromatch:3.1.10
                    └─ extglob:2.0.4
                          └─ expand-brackets:2.1.4
                                └─ debug:2.6.9
                    └─ snapdragon:0.8.2
                          └─ debug:2.6.9
        └─ webpack-dev-server:3.10.2
              └─ compression:1.7.4
                    └─ debug:2.6.9
              └─ express:4.17.1
                    └─ body-parser:1.19.0
                          └─ debug:2.6.9
                    └─ debug:2.6.9
                    └─ finalhandler:1.1.2
                          └─ debug:2.6.9
                    └─ send:0.17.1
                          └─ debug:2.6.9
              └─ serve-index:1.9.1
                    └─ debug:2.6.9

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.5) Vulnerability due to usage of acorn:6.4.1

Vulnerabilities

DepShield reports that this application's usage of acorn:6.4.1 results in the following vulnerability(s):


Occurrences

acorn:6.4.1 is a transitive dependency introduced by the following direct dependency(s):

@rollup/plugin-buble:0.21.3
        └─ buble:0.20.0
              └─ acorn:6.4.1

react-scripts:3.4.0
        └─ jest-environment-jsdom-fourteen:1.0.1
              └─ jsdom:14.1.0
                    └─ acorn:6.4.1
                    └─ acorn-globals:4.3.4
                          └─ acorn:6.4.1
        └─ webpack:4.41.5
              └─ acorn:6.4.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.uniq:4.5.0

Vulnerabilities

DepShield reports that this application's usage of lodash.uniq:4.5.0 results in the following vulnerability(s):


Occurrences

lodash.uniq:4.5.0 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ optimize-css-assets-webpack-plugin:5.0.3
              └─ cssnano:4.1.10
                    └─ cssnano-preset-default:4.0.7
                          └─ postcss-merge-rules:4.0.3
                                └─ caniuse-api:3.0.0
                                      └─ lodash.uniq:4.5.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

OnLoad page autofocus on chrono

Hello,

I have a one page infinite scroll website and when loading the focus is setting on my react chrono.
If I put of the component, it's ok of course.
Is there a way to counter that please?

Best regards,
Loïc

Setup Storybook

Create & Deploy a new documentation site with examples (story book)

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.camelcase:4.3.0

Vulnerabilities

DepShield reports that this application's usage of lodash.camelcase:4.3.0 results in the following vulnerability(s):


Occurrences

lodash.camelcase:4.3.0 is a transitive dependency introduced by the following direct dependency(s):

rollup-plugin-postcss:3.1.8
        └─ postcss-modules:2.0.0
              └─ lodash.camelcase:4.3.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.sortby:4.7.0

Vulnerabilities

DepShield reports that this application's usage of lodash.sortby:4.7.0 results in the following vulnerability(s):


Occurrences

lodash.sortby:4.7.0 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ jest:24.9.0
              └─ jest-cli:24.9.0
                    └─ jest-config:24.9.0
                          └─ jest-environment-jsdom:24.9.0
                                └─ jsdom:11.12.0
                                      └─ whatwg-url:6.5.0
                                            └─ lodash.sortby:4.7.0
        └─ jest-environment-jsdom-fourteen:1.0.1
              └─ jsdom:14.1.0
                    └─ data-urls:1.1.0
                          └─ whatwg-url:7.1.0
                                └─ lodash.sortby:4.7.0
                    └─ whatwg-url:7.1.0
                          └─ lodash.sortby:4.7.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 5.3) Vulnerability due to usage of kind-of:5.1.0

Vulnerabilities

DepShield reports that this application's usage of kind-of:5.1.0 results in the following vulnerability(s):


Occurrences

kind-of:5.1.0 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ webpack:4.41.5
              └─ micromatch:3.1.10
                    └─ snapdragon:0.8.2
                          └─ define-property:0.2.5
                                └─ is-descriptor:0.1.6
                                      └─ kind-of:5.1.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.5) Vulnerability due to usage of acorn:5.7.4

Vulnerabilities

DepShield reports that this application's usage of acorn:5.7.4 results in the following vulnerability(s):


Occurrences

acorn:5.7.4 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ jest:24.9.0
              └─ jest-cli:24.9.0
                    └─ jest-config:24.9.0
                          └─ jest-environment-jsdom:24.9.0
                                └─ jsdom:11.12.0
                                      └─ acorn:5.7.4

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Output HTML markup in cardDetailedText

Is there a way to output links or formatted lists in the card text?

I'm trying to build a timeline of user activity with actions taken including links towards the pages where the actions occured.

[DepShield] (CVSS 7.5) Vulnerability due to usage of http-proxy:1.18.1

Vulnerabilities

DepShield reports that this application's usage of http-proxy:1.18.1 results in the following vulnerability(s):


Occurrences

http-proxy:1.18.1 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ webpack-dev-server:3.10.2
              └─ http-proxy-middleware:0.19.1
                    └─ http-proxy:1.18.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

The autoScroll property of the TimelineCard component

The autoScroll property of the TimelineCard component props needs to be turned on at the developer's discretion. My current requirement here is that Autoscroll cannot be used.

My English is not very good, I wonder if you can understand。

[DepShield] (CVSS 5.3) Vulnerability due to usage of kind-of:2.0.1

Vulnerabilities

DepShield reports that this application's usage of kind-of:2.0.1 results in the following vulnerability(s):


Occurrences

kind-of:2.0.1 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ @svgr/webpack:4.3.3
              └─ @svgr/plugin-svgo:4.3.1
                    └─ merge-deep:3.0.2
                          └─ clone-deep:0.2.4
                                └─ shallow-clone:0.1.2
                                      └─ kind-of:2.0.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.5) Vulnerability due to usage of express:4.17.1

Vulnerabilities

DepShield reports that this application's usage of express:4.17.1 results in the following vulnerability(s):


Occurrences

express:4.17.1 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ webpack-dev-server:3.10.2
              └─ express:4.17.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

paginated items

First of all, thanks for the amazing project! I don't get the point of one thing. How to approach with server-side paginated items?

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.memoize:4.1.2

Vulnerabilities

DepShield reports that this application's usage of lodash.memoize:4.1.2 results in the following vulnerability(s):


Occurrences

lodash.memoize:4.1.2 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ optimize-css-assets-webpack-plugin:5.0.3
              └─ cssnano:4.1.10
                    └─ cssnano-preset-default:4.0.7
                          └─ postcss-merge-rules:4.0.3
                                └─ caniuse-api:3.0.0
                                      └─ lodash.memoize:4.1.2

ts-jest:26.3.0
        └─ lodash.memoize:4.1.2

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Working with React 16.13.0

I ran to the error about Invalid hook call when created the project with React 16.13.0

Error
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

How to solve this issue? or we just need to use React 17.0.0 or the newest?

Keep scroll position on auto load

Hi there!

On scroll end, I am loading more data to the timeline, and when loading is done, the scrollbar scrolls to the top of the timeline, which is a frustration and not user friendly because I'm loading the new data on the bottom.

Can scroll to the top be disabled for this use case?

[DepShield] (CVSS 7.5) Vulnerability due to usage of q:1.5.1

Vulnerabilities

DepShield reports that this application's usage of q:1.5.1 results in the following vulnerability(s):


Occurrences

q:1.5.1 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ @svgr/webpack:4.3.3
              └─ @svgr/plugin-svgo:4.3.1
                    └─ svgo:1.3.2
                          └─ coa:2.0.2
                                └─ q:1.5.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash._reinterpolate:3.0.0

Vulnerabilities

DepShield reports that this application's usage of lodash._reinterpolate:3.0.0 results in the following vulnerability(s):


Occurrences

lodash._reinterpolate:3.0.0 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ postcss-preset-env:6.7.0
              └─ postcss-initial:3.0.2
                    └─ lodash.template:4.5.0
                          └─ lodash._reinterpolate:3.0.0
                          └─ lodash.templatesettings:4.2.0
                                └─ lodash._reinterpolate:3.0.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Fix layout issues in Safari

Describe the bug
Timeline is not rendered properly on safari with the main link missing

Expected behavior
Timeline should be rendered properly on all browsers

Desktop (please complete the following information):

  • OS - MacOS
  • Browser [safari]

Zoom in/out

Hi Prabhu,

Are you considering inserting a zoom in/out feature for the timeline? Similar to that of zoom functionality provided by the browsers, as more events are added to the timeline, it will be easier to maneuver by zooming out and then scrolling to a specific event. Of course, the card size can be reduced manually but Inserting a zoom out button that can reduce the card size and increase the number of cards shown on the page (see image below) will be great.
image

[DepShield] (CVSS 7.5) Vulnerability due to usage of yargs-parser:11.1.1

Vulnerabilities

DepShield reports that this application's usage of yargs-parser:11.1.1 results in the following vulnerability(s):


Occurrences

yargs-parser:11.1.1 is a transitive dependency introduced by the following direct dependency(s):

react-scripts:3.4.0
        └─ webpack-dev-server:3.10.2
              └─ yargs:12.0.5
                    └─ yargs-parser:11.1.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Triggering onScroll event handler

Trying to implement a infinite scrolling Timeline where the component load more items when reaching the bottom of the list.

However, adding an onScroll event handler to the Chrono component does not trigger anything.

Is it possible to pass this along or to allow a ref to be passed to the component so an event listener can be added?

Card titles not showing on timeline?

Describe the bug
I created a vertical timeline and passed in an items object of cards with title, cardTitle, and cardSubtitle. The timeline and cards are showing correctly, but the titles are not showing.

To Reproduce
I just used the "getting started" code snippet".

Expected behavior
I expected to see titles appear on the left side of the timeline to correspond with each card.

Screenshots
Screen Shot 2020-11-29 at 9 46 54 PM

Desktop (please complete the following information):

  • OS: macOS Catalina
  • Browser: Chrome
  • Version: 87.0.4280.67

Images and videos are not showing up.

The image is present in the cards. And when we increase the height of the div, it is seen. However by default, the height of the div containing the media is 0.

My list of items looks as follows.

[{
       "title": "10th Gen Civic",
       "cardTitle": "Honda Civic",
       "cardSubtitle": "The latest Generation of civic",
       "cardDetailedText": "Honda released the 10th generation of the civic in 2016. he Civic has gone through several generational changes, becoming both larger and more upscale, moving into the compact car segment",
       "media": {
        "name": "Honda Civic",
        "type": "IMAGE",
        "source": {
          "url": "civic.jpg",
          "type": "jpg"
        }
      }
    },
    {
       "title": "May 1940",
       "cardTitle": "Dunkirk",
       "cardSubtitle": "Men of the British Expeditionary Force (BEF) wade out to..",
       "cardDetailedText": "Men of the British Expeditionary Force (BEF) wade out to..Men of the British Expeditionary Force (BEF) wade out to..Men of the British Expeditionary Force (BEF) wade out to..Men of the British Expeditionary Force (BEF) wade out to..Men of the British Expeditionary Force (BEF) wade out to..Men of the British Expeditionary Force (BEF) wade out to..Men of the British Expeditionary Force (BEF) wade out to..Men of the British Expeditionary Force (BEF) wade out to..",
       "media": {
        "source": {
          "url": "https://www.youtube.com/embed/f6cz9gtMTeI",
          "type": "mp4"
        },
        "type": "VIDEO",
        "name": "Pearl Harbor"
      }
    }
]

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.