1.0.3 • Published 5 years ago

simple-react-calendar-ts v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Simple React Calendar TypeScript

an easy to use react calander component. just 2 required props and you're on your way. easy classNames and optional custom classes just add an array with two values and now the calander will be automaticly rendered with the data.

Installation

npm install simple-react-calendar-ts

Simple Use

import Calendar, { DataObj } from 'simple-react-calendar-ts';
  state = {
    targetDay: 1,
    targetMonth: 2019-10-01
  }

  handleState = (data) => {
    this.setState(data)
  }

  <Calander
    targetDay={this.state.targetDay}
    targetMonth={this.state.targetMonth}
    title="My Custom Header"
    titleContainerClass="exampleTitleContainerClass"
    showMonth={true}
    monthTitleClass="exampleMonthTitleClass"
    onClickDay={(day: number, data: DataObj) =>
      console.log('onClick', day, data)
    }
    data={data}
    handleState={this.handleState}
    width="92%"
    containerClassName="exampleClassContainer"
    rowContainerClassName="exampleClassRow"
    dayContainerClassName="exampleClassDay"
    dayDataListClass="exampleDayDataListClass"
    dayDataListItemClass="exampleDayDataListItemClass"
    daysHeaderContainerClass="exampleDaysHeaderContainerClass"
    daysTitleContainerClass="exampleDaysTitleContainerClass"
    colorActiveDate="palegoldenrod"
    colorPastDates="#f1f1f1"
  />

or

Go to Full Example Repo

Props

nameRequired?Type, Description
targetDayRequirednumber, day in focus
targetMonthRequiredstring, month to show
titleOptionalstring, inner calendar title
showMonthOptionalboolean, show month in Calendar
handleStateOptional(data: object) => void, control state
onClickDayOptional(day: number, dayData: any) => void, function to fire when day clicked
dayComponentOptionalobject, html object to be rendered in each day
dataOptionalDataObj (name export), data to be rendered into calendar by day
widthOptionalstring, width or main calendar container
containerClassNameOptionalstring, main calendar container custom css class
rowContainerClassNameOptionalstring, custom css class for rows
dayContainerClassNameOptionalstring, custom css class for day container
dayDataListClassOptionalstring, custom css class for data prop rendering
dayDataListItemClassOptionalstring, custom css class for data prop item rendering
daysHeaderContainerClassOptionalstring, custom css class for day headers row
daysTitleContainerClassOptionalstring, custom css class for day header
titleContainerClassOptionalstring, custom css class for inner calendar title
monthTitleClassOptionalstring, custom css class for month title
colorPastDatesOptionalstring, custom color for past dates
colorActiveDateOptionalstring, custom color for active date

Copyright © 2019 <stevorated (Shirel Garber)>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago