🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-week-events

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-week-events

A React.js responsive week calendar to show/handle events

1.0.7
latest
Source
npm
Version published
Weekly downloads
17
Maintainers
1
Weekly downloads
 
Created
Source

react-week-events

A React.js responsive week calendar to show/handle events

NPM JavaScript Style Guide

Install

npm install --save react-week-events
yarn add react-week-events

Usage

import React, { Component } from 'react'
import WeekCalendar from 'react-week-events'
import 'react-week-calendar/dist/styles.css'

class Example extends Component {
  state = {
    events: [
      { name: 'Event 1', date: new Date() },
      { name: 'Event 2', date: new Date() },
      { name: 'Event 3', date: new Date() }
    ]
  }

  eventRender = (event, i) => (
    <div onClick={() => console.log(`Event: ${event.name} on position: ${i}`)}>
      {event.name}
    </div>
  )

  emptyRender = () => <div>No events</div>

  render() {
    const { events } = this.state
    return (
      <WeekCalendar
        events={events}
        emptyRender={this.emptyRender}
        eventRender={this.eventRender}
        past={true}
      />
    )
  }
}
Important: This component needs moment.js :tw-203c:

Props

PropTypeDefaultDescription
dateLabelString'date'Object date value name for render event on respective day
events[][]List of events to render
emptyRenderFunction() => 'No event'Message to show when no event
eventRenderFunction(event) => event.nameFunction to render and handle the event
pastBooleantrueOption to show past dates

License

MIT © bernagl

FAQs

Package last updated on 29 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts