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

@mormat/react-scheduler

v0.0.3

Published

React scheduler component with draggable events

Downloads

11

Readme

@mormat/react-scheduler

React scheduler component (demo)

week view | month view :-------------------------:|:-------------------------: preview | preview

A standalone version that can be installed in any HTML page without installing React is also available.

Available features

  • switch between views day, week or month
  • events can be loaded statically (from an array) or dynamically (from an ajax request for instance)
  • drag and drop events
  • create/update/delete events
  • few dependencies : only React (>= 17.0.0) and ReactDOM (>= 17.0.0) are required. The standalone version requires no dependencies at all.

Usage in a React project

Installing

npm install @mormat/react-scheduler

Loading static events

import Scheduler from "@mormat/react-scheduler";

function App() {
    
    const events = [
        {
            label: "Meeting",
            start: "2024-02-28 10:00",
            end:   "2024-02-28 12:00",
        }
    ];

    return (
        <Scheduler 
            events      = { events } 
            initialDate = "2024-02-28"
        />
    );
    
}

Loading dynamic events

@todo write other examples

Using the component in an ordinary HTML page

  1. First, you need to add the React and ReactDOM libraries in your HTML page
    <script src="//unpkg.com/react@18/umd/react.development.js"></script>
    <script src="//unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
  1. Download mormat_react_scheduler.js in the release page then add it to your HTML page.
    <script src="./mormat_react_scheduler.js"></script>
  1. Then add the lines below to render the scheduler
    <div id="scheduler"></div>
    <script>
        var props = { 
            /* the same props used in a React project */ 
        };

        var container    = document.getElementById('scheduler');
        var reactElement = React.createElement(
            mormat_react_scheduler.Scheduler, 
            props
        );

        // with React v17
        ReactDOM.render(reactElement, container)

        // with React v18
        var root = ReactDOM.createRoot(container);
        root.render(reactElement);

    </script>

The available props can be found in src/types.ts

Using the standalone version

  1. Download mormat_standalone_scheduler.js in the release page then add it to your HTML page.
    <script src="./mormat_standalone_scheduler.js"></script>
  1. Then add the lines below to render the scheduler
    <div id="scheduler"></div>
    <script>
        var props = { 
            /* the same props used in a React project */ 
        };

        mormat_standalone_scheduler.renderScheduler('#scheduler', props);
    </script>

The available props can be found in src/types.ts

Examples

Loading static events

    <div id="scheduler"></div>
    <script>
        var props = { 
            initialDate: '2024-02-01',
            events: [
                {
                    label: 'Meeting',
                    start: '2024-02-01 10:00',
                    end:   '2024-02-01 12:00',
                },
                {
                    label: 'Conference',
                    start: '2024-02-01 14:00',
                    end:   '2024-02-01 18:00',
                },
            ]
        };

        mormat_standalone_scheduler.renderScheduler('#scheduler', props);
    </script>

@todo write other examples

How it works

Inline CSS are used for styling. To avoid conflicts, all classNames are prefixed with mormat-scheduler-*