1.0.3 • Published 6 years ago

colorful-calendar v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

colorful-calendar

npm version

A simple calendar component for react applications

import React, { Component } from 'react'
import Calendar, { colorTheme } from 'colorful-calendar'
import 'colorful-calendar/Calendar.css'
import 'colorful-calendar/mediaqueries.css'

class App extends Component {
  render() {
    return (
      <div className="App">
        <Calendar
          date={new Date()}
          colors={colorTheme.redflat}
        >
      <div>
    )
  }
}

Install

Using npm

npm install colorful-calendar

Required component properties

PropertiesTypeDescription
dateObjectProvides the component with the date passed to it
colorsObjectProvides the component with the color theme chosen from calendar.colors.js

Optional feature

Pass a custom colors object

{
  textColor: "#000",
  componentBG: "#292828",
  header1BG: "#fff",
  header2BG: "#fff",
  arrowsBG: "#fff",
  weekDayNamesBG: "#fff",
  prevMonthNodesBG: "#8ee5ff",
  currentDateNodeBG: "#c4c1c1",
  currentMonthNodesBG: "#fff",
  nextMonthNodesBG: "#8ee5ff"
}

... or if you wish you can create a custom.colors.js file
Note: you can name this file whatever you would like.

custom.colors.js

const myNewColorTheme = {
  textColor: "#000",
  componentBG: "#292828",
  header1BG: "#fff",
  header2BG: "#fff",
  arrowsBG: "#fff",
  weekDayNamesBG: "#fff",
  prevMonthNodesBG: "#8ee5ff",
  currentDateNodeBG: "#c4c1c1",
  currentMonthNodesBG: "#fff",
  nextMonthNodesBG: "#8ee5ff"
}

export { myNewColorTheme, ... , ... }

App.js

import React, { Component } from 'react'
import Calendar from 'colorful-calendar'
import { myNewColorTheme } from './custom.colors.js'
import 'colorful-calendar/Calendar.css'
import 'colorful-calendar/mediaqueries.css'

class App extends Component {
  render() {
    return (
      <div className="App">
        <Calendar
          date={new Date()}
          colors={myNewColorTheme}
        >
      <div>
    )
  }
}

Color theme options

Color theme name

| original | redflat

Contribute

See development repository here