Code Monkey home page Code Monkey logo

react-diary's Introduction

React Diary

Simplifying scheduling and diary maintainance in React. It exports two components: an event-integrated month-view calendar and a compact date-picker.

Check out the live example.

Installation

Install via npm: npm install react-diary

Alternatively, install via yarn: yarn add react-diary

Ensure you have a recent version of react and react-dom installed in your project.

Usage Example

'use client' // Required if using NextJS 14 or higher
import { useState } from "react";
import { MonthCalendar, DatePicker } from "react-diary";

export default function Calendar() {
  const [selectedDate, setSelectedDate] = useState<Date>(new Date("1986-10-12T03:24:00"));

  return (
    <div>
      <MonthCalendar
        selectedDate={selectedDate}
        setSelectedDate={(date: Date) => setSelectedDate(date)} 
        events={[
          {
            startTime: new Date("1986-10-13T03:24:00"),
            title: "CLM is born",
            id: "event-1"
          }
        ]} /> 

        <DatePicker 
          selectedDate={selectedDate}
          setSelectedDate={(date: Date) => setSelectedDate(date)} 
          events={[
            {
              startTime: new Date("1986-10-13T03:24:00"),
              title: "CLM is born",
              id: "event-1"
            }
          ]} />
      </div>
  );
}

Props

<MonthCalendar /> and <DatePicker /> Props:

Prop Type Description
selectedDate (Required) Date The currently selected date in the calendar.
setSelectedDate (Required) (date: Date) => void Callback function to update the selected date.
events (Required) { startTime: Date; title: string; id: string; }[] An array of event objects to display in the calendar. Each event requires a start time, title, and unique ID. If there are no events, pass an empty array.

Contributing

All contributions, big or small, are welcome. Either raise an issue or open a pull request via GitHub.

License

This project is licensed under the ISC License.

react-diary's People

Contributors

danmolloy avatar

Stargazers

Michael 'Misha' Litchev avatar

Watchers

 avatar

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.