Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add background events #1161

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import './prism.less'
import Card from './Card'
import ExampleControlSlot from './ExampleControlSlot'
import Basic from './demos/basic'
import BackgroundEvents from './demos/backgroundEvents'
import Selectable from './demos/selectable'
import Cultures from './demos/cultures'
import Popup from './demos/popup'
Expand All @@ -35,6 +36,7 @@ let demoRoot =

const EXAMPLES = {
basic: 'Basic Calendar',
backgroundEvents: 'Background Events',
selectable: 'Create events',
cultures: 'Localization',
popup: 'Show more via a popup',
Expand Down Expand Up @@ -69,6 +71,7 @@ class Example extends React.Component {
let selected = this.state.selected
let Current = {
basic: Basic,
backgroundEvents: BackgroundEvents,
selectable: Selectable,
cultures: Cultures,
popup: Popup,
Expand Down
7 changes: 7 additions & 0 deletions examples/backgroundEvents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default [
{
id: 0,
start: new Date(2015, 3, 13, 5, 0, 0),
end: new Date(2015, 3, 13, 16, 0, 0),
},
]
22 changes: 22 additions & 0 deletions examples/demos/backgroundEvents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import BigCalendar from 'react-big-calendar'
import events from '../events'
import backgroundEvents from '../backgroundEvents'
import dates from '../../src/utils/dates'

let allViews = Object.keys(BigCalendar.Views).map(k => BigCalendar.Views[k])

let Basic = ({ localizer }) => (
<BigCalendar
events={events}
views={allViews}
step={60}
showMultiDayTimes
max={dates.add(dates.endOf(new Date(2015, 17, 1), 'day'), -1, 'hours')}
defaultDate={new Date(2015, 3, 1)}
localizer={localizer}
backgroundEvents={backgroundEvents}
/>
)

export default Basic
Loading