ForwardWidgets
Widgets for Douban and Trakt watchlists plus personalized recommendations, live TV streaming including PlutoTV, Yatu ra…
JavaScript★ 247
A calendar component for React
git clone https://github.com/nathanstitt/dayz.gitnathanstitt/dayzAn interactive demo can be viewed at: http://nathanstitt.github.io/dayz/
The demo source for the demo is demo.jsx
npm install dayz --save -- or -- yarn add dayz
import React from 'react';
import Dayz from 'dayz';
// could also import the sass if you have a loader at dayz/dayz.scss
import "dayz/dist/dayz.css";
import moment from 'moment';
// would come from a network request in a "real" app
const EVENTS = new Dayz.EventsCollection([
{ content: 'A short event',
range: moment.range( date.clone(),
date.clone().add(1, 'day') ) },
{ content: 'Two Hours ~ 8-10',
range: moment.range( date.clone().hour(8),
date.clone().hour(10) ) },
{ content: "A Longer Event",
range: moment.range( date.clone().subtract(2,'days'),
date.clone().add(8,'days') ) }
]);
class MyComponent extends React.Component {
render() {
return <Dayz
display='week'
date={this.props.date}
events={EVENTS}
/>
}
}
The Dayz component accepts these properties:
momentjs instance that controls what range is displayed. The calendar will automatically calculate the month or week that contains this date and display the appropriate range.Dayz.EventsCollection instance that contains events that should be displayed on the calendar.
Dayz.EventsCollection accepts two arguments:
true it will show events that are marked as an all day event at the top of the week and day views prior to showing other events. If false, events marked as an all day event will completely fill the column for the day, with other events appearing on top of it. defaults to true. Please note: Although sometimes useful, if set to false it can create a very cluttered calendar.false, for events that are shown on multiple days only the first event will have the content attribute shown. In any other case content will be shown on every day. This prop works only if displayAllDay is false.momentjs date. Hours/Minutes are added to the date to reflect how far down the Y axis was clicked.event subkey that includes the event itself.ha configures y labels time formaten. A string to determine the localization.undefined. Determines whether the week should start on Monday or Sunday. By default it uses what the localization offers (see locale prop). It can accept either 0 to start the week on Sunday or 1 to start the week on Monday.Dayz applies these css classes:
npm start starts up a local development web-server which rebuilds files when changed
npm test runs unit testsnpm run build compiles files in preparation for publishingmore like this
Widgets for Douban and Trakt watchlists plus personalized recommendations, live TV streaming including PlutoTV, Yatu ra…
search projects, people, and tags