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

react-mn-calendar

v1.6.1

Published

React calendar library with Mongolian localization

Downloads

61

Readme

Big Calendar React

react-mn-calendar is a customizable React calendar component library that includes two calendar components: Calendar and SmallCalendar. This library provides flexible calendar solutions with easy integration and style customization.

Installation

To install react-mn-calendar in your React project, use npm or yarn:

npm install react-mn-calendar

or

yarn add react-mn-calendar

Usage

Importing components

You can import and use the Calendar and SmallCalendar components as follows:

import React from 'react';
import { Calendar, SmallCalendar, MonthCalendar } from 'react-mn-calendar';

const App = () => {
    const SmallCalendarExampleEvents = [
    { date: new Date(2024, 7, 20), color: "#ff0000" },
    { date: new Date(2024, 7, 22), color: "#00ff00" },
    { date: new Date(2024, 7, 22), color: "#00ff00" },
    { date: new Date(2024, 7, 21) },
    { date: new Date(2024, 7, 25) },
    { date: new Date(2024, 7, 22), color: "#00ff00" },
  ]
  const CalendarExampleEvents = [
    {
      id: "1",
      title: "Meeting with Team",
      date: "2024-08-25T10:00:00Z",
      color: "#33FF57",
      data: {
        location: "Conference Room A",
        attendees: ["John Doe", "Jane Smith", "Michael Brown"],
        description: "Discuss the Q3 project updates and deliverables.",
      },
    },
    {
      id: "2",
      title: "Doctor's Appointment",
      date: "2024-08-26T14:30:00Z",
      color: "#33FF57",
      data: {
        location: "Downtown Clinic",
        doctor: "Dr. Emily Clark",
        notes: "Routine check-up.",
      },
    },
  ]

  return (
    <div>
      <h1>My Calendar App</h1>
      <Calendar events={CalendarExampleEvents} />
      <SmallCalendar  events={SmallCalendarExampleEvents} />
       <MonthCalendar
            onClickMonth={function (val: Date): void {
              console.log(val)
            }}
          />
    </div>
  );
};

export default App;

Calendar Component

The Calendar component displays a full-sized calendar view.

Event Props:

  • id (string): Unique identifier for the event.
  • title (string): Title of the event.
  • date (string): Event date in ISO string format.
  • color (string, optional): Background color for the event.
  • data (any, optional): add Data to your object if need be.

Calendar Props

  • mainColor: theme main color (optional)
  • onDateClick: return a Date object
  • onEventClick: returns a Event object as mention in the Event Props section
  • renderHeader : function to render your own header for the calendar (only on the normal Calendar)
  • onMonthClick : return clicked month Date (MonthPicker only)

Example:

Custom Header example


interface CustomHeaderProps {
  currentDate: () => string
  prevMonth: () => void
  nextMonth: () => void
  setCurrentDate: (date: Date) => void
}

const CustomHeader: React.FC<CustomHeaderProps> = ({ currentDate, prevMonth, nextMonth, setCurrentDate }) => {
  const UpperCaseFirstLetter = (string: string): string => {
    return string.charAt(0).toUpperCase() + string.slice(1)
  }
  return (
    <div className="custom-header">
      <button onClick={prevMonth}>Previous</button>
      <span>{currentDate()}</span>
      <button onClick={nextMonth}>Next</button>
      <button onClick={() => setCurrentDate(new Date())}>Today</button>
    </div>
  )
}


function App() {

  const events = [
    { id: "1", title: "Event 1", date: "2024-08-10", color: "#FF5733" }, // Example: red-orange
    { id: "2", title: "Event 2", date: "2024-08-15", color: "#33FF57" }, // Example: green
    { id: "3", title: "Event 3", date: "2024-08-15", color: "#3357FF" }, // Example: blue
    { id: "4", title: "Event 4", date: "2024-08-15", color: "#FF33A5" }, // Example: pink
  ]

  const handleDateClick = (day: Date) => {
    console.log("Date clicked:", day)
  }

  const handleEventClick = (event: any) => {
    console.log(event)
  }

  return (
    <div className="App">
        <BigCalendar
          events={events}
          onDateClick={handleDateClick}
          onEventClick={handleEventClick}
          renderHeader={(currentDate, prevMonth, nextMonth, setCurrentDate) => (
            <CustomHeader currentDate={currentDate} prevMonth={prevMonth} nextMonth={nextMonth} setCurrentDate={setCurrentDate} />
          )}
        />
    </div>
  )
}

export default App

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request. Ensure that your changes adhere to the project's coding standards and include tests where applicable.

Git repository

Issues

If you encounter any issues or have feature requests, please open an issue on the GitHub repository.

Acknowledgements

Thanks to all contributors and libraries that made this project possible.

  • currently me