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

@pratikdhungel/react-calendar-month-view

v0.9.0

Published

Monthly Calendar React Component, inspired by a Squarespace calendar theme. Forked and updated for personal requirements

Downloads

8

Readme

react-calendar-month-view npm version

A simple and customizable monthly calendar component view.

Demo & Examples

Live Demo

To build the examples locally, clone this repo and run:

npm install
npm start

or

yarn install
yarn start

Then open localhost:8080 in a browser.

Installation

Install directly from NPM:

npm install react-calendar-month-view --save

or

yarn add react-calendar-month-view

Usage

Use this component to display a month view of a calendar with supplied event duration indicators.

import CalendarMonthView from 'react-calendar-month-view';

class App extends Component {
  // date is given as an ISO-8601 string
  _renderDay = (date) => {
    // return a component to render for the given date
  };

  render() {
    return <CalendarMonthView renderDay={this._renderDay} />;
  }
}

Functions accessible with a ref

isSmallCalendar()

Returns if the calendar is a small calendar.

Example:

_renderDay = date => {
  if (this.calendar && this.calendar.isSmallCalendar()) {
    // renderDay for small calendar
  } else {
    // renderDay for normal calendar
  }
};

render() {
  return (
    <CalendarMonthView
      ref={ref => (this.calendar = ref)}
      renderDay={this._renderDay}
    />
  );
}

Props

| prop | type | default | description | | ---------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | width | string | "90%" | Specifies the width of the calendar (height is dynamically set and therefore cannot be customized). Examples. "500px", "90vw", "90%" | | renderDay | function | null | Callback used to render a given day | | onMonthChange | function | null | Callback that is fired when the month is changed (Fires once on component mount) | | titleTextStyle | object | null | Custom styles for the title text | | dayNameTextStyle | object | null | Custom styles for the day names (header row of the calendar) | | dayTextStyle | object | null | Custom styles for the numbers that correspond to the days on the calendar | | activeDayStyle | object | null | Custom styles for the calendar tile corresponding to the current day | | inactiveDayStyle | object | null | Custom styles for the calendar tile corresponding days that are not the current day | | currentMonth | number | null | Specify the current month to be displayed in the calendar on component mount. Value should be based on moment's set method i.e 0 => Jan, 1 = Feb and so on | | currentYear | number | null | Specify the current year to be displayed in the calendar on component mount. |

Prop Functions:

renderDay(isoDate: string)

isoDate is a ISO-8601 string that represents the current day being rendered.

Example:

const renderDay = (isoDate) => {
  return <div> ... </div>;
};

onMonthChange(startDate)

startDate is a ISO-8601 string representing the start date of the current month, after the month is changed (Fires once when component is mounted)

Example:

const onMonthChange = (startDate) => {
  // eg. retrieve data from gcal
};

Notes

Use the width to control the size of the calendar component.