1.3.2 • Published 8 months ago

schedulio v1.3.2

Weekly downloads
-
License
CC BY-NC-ND 4.0
Repository
github
Last release
8 months ago

schedulio

Highly designed, optimized and extensible react schedule component.

Introduction

A powerful and versatile scheduling solution designed to simplify your life. With its highly extensible architecture, stunningly beautiful UI, and meticulously optimized codebase, managing your events has never been easier.

Schedulio Images

Light mode schedule

Dark mode schedule

Features

  • Highly Extensible: Our component is designed with flexibility in mind, allowing you to effortlessly incorporate your custom components and themes. It's your canvas to create the scheduling tool that suits your vision.
  • Beautiful UI: Enjoy a visually appealing and intuitive UI that enhances the scheduling experience, while the extensibility ensures it remains in line with your brand and requirements.
  • Efficient Performance: Our codebase is optimized for efficiency, even when handling substantial event data. Your schedules remain responsive and performant.
  • User-Friendly Integration: Whether you're an experienced React developer or new to the framework, our component is designed to be straightforward to integrate, saving you time and effort.

Install

To use schedulio, you can install it via npm or from GitHub Repository. Choose the option that suits your project's requirements.

NPM

If you are using a package manager like npm you can easily install schedulio by running the following command:

npm install schedulio

NOTE:If schedulio isn't functioning correctly in your React TypeScript project, consider restarting it.

Quickstart

import React from "react";
import { useSchedule } from "schedulio";

const FunctionComponentExample = () => {
  /*
   *NOTE: The current version of Schedulio only works with 24H time format
   *NOTE: StartHour and EndHour of the schedule can be only a round time => 8 15:00
   *NOTE: can't be 15:15 in this case a round function run to transform your endHour(15:30) to 16:00
   */
  const events = [
    {
      object: "first event",
      description: "will be a boring event",
      startHour: "15:00", // 24H Format equal to 3PM
      duration: 60, // minutes
      day: "Tue",
      id: "unique ID_6565658",
    },
  ];
  const { Schedule, currentEvents } = useSchedule({
    defaultEvents: events,
    startHour: "8:00",
    endHour: "17:00",
  });

  return (
    <div style={{ width: "100%" }}>
      <Schedule />
    </div>
  );
};

export default FunctionComponentExample;

Params

Params of useSchedule Hook

ParamTypeDescriptiondefault valueRequired
startHourstringcan be only a round time like '8:00','8'"00:00"not required
endHourstringcan be only a round time like '15:00','15'"23:00"not required
daysstring[]specify the days of the schedule"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"not required
defaultEventsEvent[][]not required
startDatedatedate of the first day in the schedule headerCurrent Datenot required
IDGeneratorfunctionFunction that return id to the new eventsFunction that return a string with a 20 lengthnot required
eventThemeThemespecify the theme of the eventschedulio work with random themes by defaultnot required
onCreateEventasync function(newEvent)async function injected by newEvent object-not required
onUpdateEventasync function(updatedEvent)async function injected by updatedEvent object-not required
onDeleteEventasync function(deletedEvent)async function injected by deletedEvent object-not required
randomThemesTheme[]customize random themes array-not required
eventComponentReact componentSchedulio is highly extensible so feel free to add other params to your custom event component-not required
darkModebooleanfalsenot required

Params of Event object

KeyTypeRequired
startHourstringtrue
durationnumbertrue
daystringtrue
idstring or numbertrue
objectstringfalse
descriptionstringfalse

Params of Theme object

KeyTypeRequired
namestringtrue
titleColorstringtrue
backgroundColorstringtrue
borderColorstringtrue
modeSupporteddark , light , bothtrue

Complet Example

import React from "react";
import { useSchedule } from "schedulio";
import axios from "axios";

const CustomEventComponent = ({
  day,
  startHour,
  duration,
  object,
  description,
  newParam,
}) => {
  // return your jsx
};

const FunctionComponentExample = () => {
  const events = [
    {
      object: "first event",
      description: "will be a boring event",
      startHour: "15:00", // 24H Format equal to 3PM
      duration: 60, // minutes
      day: "Tue",
      id: "45654544",
      newParam: "labla", // you can add params to use it in your custom event component
    },
  ];
  const { Schedule, currentEvents, defaultDays } = useSchedule({
    defaultEvents: events,
    startHour: "8:00",
    endHour: "17:00",
    darkMode: false, // default value
    theme: {
      name: "indigoTheme",
      titleColor: "#ffffff",
      backgroundColor: "#6366f1",
      borderColor: "#6366f1",
    },
    days: ["Tue", "Sat", "Sun"],
    IDGenerator: () => {
      var id = "";
      for (let i = 0; i < 20; i++) {
        id += parseInt(Math.random() * 10);
      }
      return id;
    },
    onCreateEvent: async (newEvent) => {
      const response = await axios.post("/api/v1/saveEvent", newEvent);
      console.log("event has been saved");
    },
    onUpdateEvent: async (updatedEvent) => {
      const response = await axios.put("/api/v1/updateEvent", updatedEvent);
      console.log("event has been updated");
    },
    onDeleteEvent: async (deletedEvent) => {
      const response = await axios.delete("/api/v1/deleteEvent", deletedEvent);
      console.log("event has been deleted");
    },
    eventComponent: CustomEventComponent,
  });
  console.log(defaultDays); // ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
  return (
    <div style={{ width: "100%" }}>
      <Schedule />
    </div>
  );
};

export default FunctionComponentExample;

currentEvents

Thhe currentEvents returned by useSchedule hook is a react state so any change in the schedule events trigger re-render in your schedule container component. In this case, you can access the new value of your schedule in real time.

Attribution

This project is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (CC BY-NC-ND 4.0)

If you use or share any part of this project, please provide proper attribution to the original author:

If you like my work so please support me on GitHub.

1.2.0

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.1.8

8 months ago

1.0.9

8 months ago

1.1.7

8 months ago

1.0.8

8 months ago

1.1.6

8 months ago

1.0.7

8 months ago

1.1.5

8 months ago

1.3.2

8 months ago

1.0.5

8 months ago

1.3.1

8 months ago

1.0.4

8 months ago

1.3.0

8 months ago

1.1.2

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago

1.0.0

8 months ago