npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

timeline-calendar

v0.1.12

Published

Simple timeline calendar for React that is easy to customize and work with.

Downloads

96

Readme

Timeline Calendar for React.

Simple timeline calendar for React that is easy to customize and work with.

import React, { useState } from "react";
import TimelineCalendar from "timeline-calendar";

// Import this CSS file if you do not want to implement all the details yourself.
import "../node_modules/timeline-calendar/dist/lib.esm.css";

let events = [
    {
      id: 1,
      title: "Meeting with CEO",
      start: new Date("2022-11-15 10:00"),
      end: new Date("2022-11-15 12:00"),
    },
    {
      id: 2,
      title: "Leisure",
      start: new Date("2022-11-17 08:00"),
      end: new Date("2022-11-18 14:00"),
    }
];

let options = {
    events: events,
    // events: Event[];
    // numberOfColumns?: number; Defaults to 7 (weekly).
    // onCellClick?: (date: Date) => void;
    // onEventClick?: (event: Event) => void;
    // disableCellPredicate?: (date: Date) => boolean; Defaults to false.
    // hourWindowDateFormat?: string; Format of the string is based on Unicode Technical Standard #35
    // dateWindowDateFormat?: string; Format of the string is based on Unicode Technical Standard #35
    // businessHourStart?: number; Defaults to 8.
}

export default function App() {
    let [date, setDate] = useState(new Date());

    return <TimelineCalendar {...options} currentDate={date} />;
}

Screenshot 2022-11-16 at 14 04 57

It is easy to customize the theme by defining CSS variables in :root.

:root {
    --cell-divider-color: #dce5ec;
    --cell-bg-color: white;
    --xy-bg-color: #eef6fd;
    --xy-color: #606060;
    --xy-divider-color: #b1bbc4;
    --border-color: transparent;
    --event-color: rgba(225, 81, 83, 0.75);
    --cell-hover-color: #a8a8a8;
    --cell-disabled-color: rgb(245, 245, 245);
}

Change height by assigning height to this CSS class:

.timeline-calendar {
    height: 800px !important;
}

.calendar-grid {
    height: 600px !important;
}

This package exports ESM only at this point in time.