Socket
Socket
Sign inDemoInstall

react-week-events

Package Overview
Dependencies
8
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-week-events

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


Version published
Maintainers
1
Install size
32.3 kB
Created

Readme

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

Last updated on 29 Jul 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc