0.1.3 • Published 3 years ago

@vespaiach/month-view v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Why

If you just need a quick calendar view by month for your React app, this piece of ui will help.

Usage

  1. Install package
npm i @vespaiach/month-view -S
  1. The gist
import '@vespaiach/month-view/dist/base.css'; // Tailwindcss's preflight. This is optional, but recommended
import '@vespaiach/month-view/dist/month.css';

import './app.css';

import * as React from 'react';

import { MonthView } from '@vespaiach/month-view';
import { MonthNum } from '@vespaiach/month-view/dist/type';

export default function App() {
    const [date, setDate] = React.useState(new Date());

    return (
        <MonthView year={date.getFullYear()} month={date.getMonth() as MonthNum} />
    );
}
  1. Properties
PropertiesNotetyperequired
yearYearnumberyes
monthMonth (start from 0)numberyes
eventsList of events will be displayed on the calendar{ title:string; start: Date; minutes: number}[]no
classNameCss classstringno
onClickClick event handler(date: Date, events: Event[], evt: MouseEvent>) => voidno
DAYSCustom name of day (Sun, Mon...)string[]no
MONTHSCustom name of month (Jan, Feb...)string[]no
colorsCustom color of calendar**object[]no

**

    colors?: {
        gridLine?: string;
        sheetBackground?: string;
        dayText?: string;
        grayedOutText?: string;
        normalText?: string;
        lightText?: string;
        todayCircle?: string;
        eventListDot?: string;
    };

Development

This React component is bootstrapping with ViteJS, styling with Tailwindcss, testing with Vitest and building with Microbundle and Postcss.

NPM commands

  • To start development page: npm run dev
  • To test the lib: npm run test.
  • To build for production: npm run build.

Note

In fact, Microbundle can build css files too, but it automatically merges css files into one which also includes Tailwindcss's preflight set, and that may not what users want. Tailwindcss's preflight set should be excluded and let users decide to add it in their project whether or not. So let Postcss takes the job of building css instead.

License

MIT

0.1.2

3 years ago

0.1.1

3 years ago

0.1.3

3 years ago

0.1.0

3 years ago