Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evolvier/react-daily-timeline-sheet

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evolvier/react-daily-timeline-sheet

A timeline component for tracking working hours.

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

React Daily TimeLine Sheet

A customizable timeline component for React applications. The React Daily TimeLine Sheet component visualizes working and non-working hours in a horizontal timeline, making it ideal for time-tracking apps, schedules, and other applications where time management is key.

React Daily TimeLine Sheet

Here are some visual examples of the TimeLine component:

  • Example 1
  • Example 2
  • Example 3

Features

  • Customizable Colors and Styles: Easily configure colors for working and non-working segments, and adjust height and border-radius.
  • Flexible Time Formats: Choose between 12-hour and 24-hour time formats to match your application's requirements.
  • Custom Tooltips: Optionally provide a custom tooltip renderer for more personalized information display.
  • Responsive Breakpoints: Automatically adjust the timeline’s intervals based on responsive breakpoints.
  • Non-working Hours Support: Display non-working hours with a customizable caption when no working hours are available.

Installation

Install the React Daily TimeLine Sheet component via NPM:

npm install react-daily-timeline-sheet

Usage

Basic Example Import and use the React Daily TimeLine Sheet in your React project:

import React from 'react';
import TimeLine from 'react-daily-timeline-sheet';

const workingHours = [
  {
    start: '09:00',
    end: '17:00',
    title: 'Work',
    status: 'InProgress',
  },
  // Add more working hours as needed
];

const App = () => {
  return (
    <div>
      <h1>My TimeLine</h1>
      <TimeLine
        workingHours={workingHours}
      />
    </div>
  );
};

export default App;

Custom Example

Import and use the React Daily TimeLine Sheet in your React project:

import React from 'react';
import TimeLine from 'react-daily-timeline-sheet';

const workingHours = [
  {
    start: '09:00',
    end: '17:00',
    title: 'Work',
    status: 'InProgress',
  },
  // Add more working hours as needed
];

const renderTooltip = (segment: any) => (
  <div
    style={{
      padding: "5px",
      backgroundColor: "#4d4d4c",
      color: "#fff",
      borderRadius: "3px",
    }}
  >
    <strong>{segment.tooltip}</strong>
    {segment.status && <div>Status: {segment.status}</div>}
  </div>
);

const App = () => {
  return (
    <div>
      <h1>My TimeLine</h1>
     <TimeLine
        workingHours={[
          { start: "09:00", end: "12:00", title: "Morning Shift" },
          { start: "13:00", end: "17:00", title: "Afternoon Shift" },
          { start: "18:00", end: "21:00", title: "Evening Shift" },
        ]}
        breakpoint="lg"
        workingColor="#578ff2"
        nonWorkingColor="#e0e0e0"
        height="50px"
        borderRadius="12px"
        timeFormat="12h"
        notWorkingCaption="No working hours today"
        renderTooltip={renderTooltip}
      />
    </div>
  );
};

export default App;

Custom Tooltips

To customize the tooltip displayed for each segment, use the renderTooltip prop:

import React from 'react';
import TimeLine from 'react-daily-timeline-sheet';

const customTooltip = (segment) => (
  <div>
    <strong>{segment.tooltip}</strong>
  </div>
);

const workingHours = [
  {
    start: '09:00',
    end: '17:00',
    title: 'Work',
    status: 'InProgress',
  },
  // Add more working hours as needed
];

const App = () => {
  return (
    <div>
      <h1>My Custom TimeLine</h1>
      <TimeLine
        workingHours={workingHours}
        renderTooltip={customTooltip}
        workingColor="#76c7c0"
        nonWorkingColor="#e0e0e0"
        height="40px"
        borderRadius="12px"
        timeFormat="24h"
        notWorkingCaption="No work"
      />
    </div>
  );
};

export default App;

Props

TimeLine Component Props

PropTypeDefaultDescription
workingHoursWorkingHour[][]Array of working hours to display. Each object should include start, end, title, and optionally status.
breakpoint`"md""lg"`"lg"
workingColorstring"#76c7c0"Color for the working hours segments.
nonWorkingColorstring"#e0e0e0"Color for the non-working hours segments.
heightstring"40px"Height of the timeline.
borderRadiusstring"12px"Border radius of the timeline.
timeFormat`"12h""24h"`"12h"
notWorkingCaptionstring"Not working at this time"Caption to display when there are no working hours available.
renderTooltip(segment: Segment) => React.ReactNode-Custom function to render tooltips for each segment. If not provided, a default tooltip is used.

WorkingHour Interface

PropertyTypeDescription
startstringStart time in HH format.
endstringEnd time in HH format.
titlestringTitle or description of the shift.
statusstring(Optional) Status of the shift.

Segment Interface

PropertyTypeDescription
type`"working""non-working"`
startPercentnumberStart position as a percentage.
widthPercentnumberWidth of the segment as a percentage.
tooltipstringTooltip text to be displayed.
statusstring(Optional) Status of the working segment.

Keywords

FAQs

Package last updated on 18 Nov 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc