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

tt-react-calendar

v1.5.9

Published

A React calendar component with as few frills as humanly possible

Downloads

67

Readme

TT React Calendar

NPM Version Build Status Downloads Stats Coverage Status

Description

A no-frills calendar widget that lets you bring your own styling. This component takes a start date, an end date, and a renderDay function, and then gets out of the way.

Example

View a working example here.

Installation

npm install --save tt-react-calendar

Usage

import Calendar from 'tt-react-calendar';

function renderDay(day) {
  return <div className="day">{day.format('dd')}</div>
}

function renderMonthHeader(firstDay, format) {
  // Don't render month headers for 2016, for some reason.
  if (firstDay.year() === 2017) {
    return firstDay.format(format);
  }
}

function MyComponent() {
  return (
    <Calendar
      className="calendar-container"
      dayAbbrevs={['Su', 'M', 'T', 'W', 'Th', 'F', 'Sa']}
      dayHeaderClassName="calendar-day-header"
      dayHeaderStyle={Calendar.DayHeaderStyles.InFirstMonth}
      firstRenderedDay="2016-12-25"
      lastRenderedDay="2017-02-12"
      monthClassName="calendar-month"
      monthHeaderFormat="MMMM YYYY"
      monthHeaderClassName="calendar-month-header"
      renderDay={renderDay}
      renderMonthHeader={renderMonthHeader}
      weekClassName="calendar-week"
    />
  );
}

And somewhere in your stylesheet build process...

@import 'tt-react-calendar/dist/styles.css';

Properties

Name | Type | Description | Since Version -----|------|-------------|-------------- className | string | Class name for the calendar's container element | 1.0.0 compactMonths | bool | A flag that combines all of the months into one continuous block of days, with the month header split out and positioned along the left edge of the container. This sets position: absolute, right: 100%, and margin: 0 on the month header class, so override those properties in your CSS if you think you have better ideas. | 1.3.0 dayAbbrevs | Array.<string> | Array of day names, starting with Sunday. Defaults to ['Su', 'M', 'T', 'W', 'Th', 'F', 'Sa']. | 1.0.0 dayHeaderClassName | string | Class name for the day header container element | 1.2.0 dayHeaderStyle | Enum | Determines where the day column headers are rendered. Can be one of Calendar.DayHeaderStyles.InFirstMonth (the default), Calendar.DayHeaderStyles.AboveFirstMonth, or Calendar.DayHeaderStyles.InEveryMonth | 1.0.0 firstRenderedDay | varied | The first date that will be rendered as part of the calendar. Can be any type that moment's constructor supports. | 1.0.0 gutterWidth | string | CSS value to use as the gutter between columns | 1.5.0 lastRenderedDay | varied | The last date that will be rendered as part of the calendar. Can be any type that moment's constructor supports. | 1.0.0 monthClassName | string | Class name to add to each month element | 1.0.0 monthHeaderFormat | string | Format of the month header text. See moment.format for the available options. Defaults to 'MMMM YYYY'. | 1.0.0 monthHeaderClassName | string | Class name to add to each month header h3 element | 1.0.0 renderDay | function | A function that takes a moment object of a single day as a parameter and returns a React element. Defaults to (day) => <div>{day.format('YYYY-MM-DD')}</div> | 1.0.0 renderMonthHeader | function | A function that takes a moment object and the value of the monthHeaderFormat prop, and returns a React element. Defaults to (firstDay, format) => firstDay.format(format) | 1.4.0 weekClassName | string | Class name for the week element | 1.1.0

Browser Support

This is still a very young project, so it hasn't been actively tested in cross browser environments. That being said, given the technologies being used, it should work in any browser that supports some form of flexbox.

Google Chrome | Mozilla Firefox | Microsoft Internet Explorer | Microsoft Edge | Safari -----|-----|-----|-----|----- Yes | Yes | 10+ | Yes | Yes

See caniuse.com for more details

Development

Issues/PRs welcome!

Set up dev environment

tt-react-calendar uses yarn for its package management during development. If you don't already have yarn installed on your machine, follow the installation instructions here. Once yarn is installed, you can simply run

yarn

to install all development dependencies.

Contributing

Please make sure your code passes our tests and linter.

yarn test
yarn run lint

It's not scary! Just a few code style rules to keep devs from shooting themselves in the foot, and tests to make sure we didn't accidentally break anything.

Meta

Distributed under the MIT License. See LICENSE for more information.

Developers:

Jeremy Tice @jetpacmonkey