diff --git a/examples/Intro.md b/examples/Intro.md
index 44962afeb..3ee894bb7 100644
--- a/examples/Intro.md
+++ b/examples/Intro.md
@@ -21,16 +21,16 @@ Choose the localizer that best suits your needs, or write your own. Whatever you
before you can use the calendar (you only need to set it up once).
```jsx
-import BigCalendar from 'react-big-calendar'
+import { Calendar, momentLocalizer } from 'react-big-calendar'
import moment from 'moment'
// Setup the localizer by providing the moment (or globalize) Object
// to the correct localizer.
-const localizer = BigCalendar.momentLocalizer(moment) // or globalizeLocalizer
+const localizer = momentLocalizer(moment) // or globalizeLocalizer
const MyCalendar = props => (
-
BigCalendar.Views[k])
+let allViews = Object.keys(Views).map(k => Views[k])
const ColoredDateCellWrapper = ({ children }) =>
React.cloneElement(React.Children.only(children), {
@@ -13,7 +13,7 @@ const ColoredDateCellWrapper = ({ children }) =>
})
let Basic = ({ localizer }) => (
-
- NESTED COMPONENT
@@ -13,7 +13,7 @@ let MyCustomHeader = ({ label }) => (
)
let CustomHeader = ({ localizer }) => (
- {
MyWeek.navigate = (date, action) => {
switch (action) {
- case BigCalendar.Navigate.PREVIOUS:
+ case Navigate.PREVIOUS:
return dates.add(date, -3, 'day')
- case BigCalendar.Navigate.NEXT:
+ case Navigate.NEXT:
return dates.add(date, 3, 'day')
default:
@@ -52,10 +52,10 @@ let CustomView = ({ localizer }) => (
The Calendar below implments a custom 3-day week view
-
diff --git a/examples/demos/dnd.js b/examples/demos/dnd.js
index 2ff643178..16bc2e8f2 100644
--- a/examples/demos/dnd.js
+++ b/examples/demos/dnd.js
@@ -1,11 +1,11 @@
import React from 'react'
import events from '../events'
-import BigCalendar from 'react-big-calendar'
+import { Calendar, Views } from 'react-big-calendar'
import withDragAndDrop from 'react-big-calendar/lib/addons/dragAndDrop'
import 'react-big-calendar/lib/addons/dragAndDrop/styles.scss'
-const DragAndDropCalendar = withDragAndDrop(BigCalendar)
+const DragAndDropCalendar = withDragAndDrop(Calendar)
class Dnd extends React.Component {
constructor(props) {
@@ -84,7 +84,7 @@ class Dnd extends React.Component {
onEventResize={this.resizeEvent}
onSelectSlot={this.newEvent}
onDragStart={console.log}
- defaultView={BigCalendar.Views.MONTH}
+ defaultView={Views.MONTH}
defaultDate={new Date(2015, 3, 12)}
/>
)
diff --git a/examples/demos/dndOutsideSource.js b/examples/demos/dndOutsideSource.js
index e5050a3d0..fb7c95dc7 100644
--- a/examples/demos/dndOutsideSource.js
+++ b/examples/demos/dndOutsideSource.js
@@ -1,13 +1,13 @@
import React from 'react'
import events from '../events'
-import BigCalendar from 'react-big-calendar'
+import { Calendar, Views } from 'react-big-calendar'
import withDragAndDrop from 'react-big-calendar/lib/addons/dragAndDrop'
import Layout from 'react-tackle-box/Layout'
import Card from '../Card'
import 'react-big-calendar/lib/addons/dragAndDrop/styles.scss'
-const DragAndDropCalendar = withDragAndDrop(BigCalendar)
+const DragAndDropCalendar = withDragAndDrop(Calendar)
const formatName = (name, count) => `${name} ID ${count}`
@@ -163,7 +163,7 @@ class Dnd extends React.Component {
onEventResize={this.resizeEvent}
onSelectSlot={this.newEvent}
onD
- defaultView={BigCalendar.Views.MONTH}
+ defaultView={Views.MONTH}
defaultDate={new Date(2015, 3, 12)}
/>
diff --git a/examples/demos/dndresource.js b/examples/demos/dndresource.js
index 75364af1d..cd1e0b6e5 100644
--- a/examples/demos/dndresource.js
+++ b/examples/demos/dndresource.js
@@ -1,10 +1,10 @@
import React from 'react'
-import BigCalendar from 'react-big-calendar'
+import { Calendar } from 'react-big-calendar'
import withDragAndDrop from 'react-big-calendar/lib/addons/dragAndDrop'
import 'react-big-calendar/lib/addons/dragAndDrop/styles.scss'
-const DragAndDropCalendar = withDragAndDrop(BigCalendar)
+const DragAndDropCalendar = withDragAndDrop(Calendar)
const events = [
{
diff --git a/examples/demos/popup.js b/examples/demos/popup.js
index 94f34df9a..1eea7da84 100644
--- a/examples/demos/popup.js
+++ b/examples/demos/popup.js
@@ -1,5 +1,5 @@
import React from 'react'
-import BigCalendar from 'react-big-calendar'
+import { Calendar } from 'react-big-calendar'
import events from '../events'
import ExampleControlSlot from '../ExampleControlSlot'
@@ -11,7 +11,7 @@ let Popup = ({ localizer }) => (
days events to see an inline popup of all the events.
- {
}
let Rendering = ({ localizer }) => (
- (
<>
-
- alert(event.title)}
diff --git a/examples/demos/timeslots.js b/examples/demos/timeslots.js
index b556a9f33..0e33d4db8 100644
--- a/examples/demos/timeslots.js
+++ b/examples/demos/timeslots.js
@@ -1,14 +1,14 @@
import React from 'react'
-import BigCalendar from 'react-big-calendar'
+import { Calendar, Views } from 'react-big-calendar'
import events from '../events'
let Timeslots = ({ localizer }) => (
-
)
diff --git a/src/Calendar.js b/src/Calendar.js
index 8a773351b..25fac52d1 100644
--- a/src/Calendar.js
+++ b/src/Calendar.js
@@ -363,7 +363,7 @@ class Calendar extends React.Component {
* }
* ```
*
- * @type Calendar.Views ('month'|'week'|'work_week'|'day'|'agenda')
+ * @type Views ('month'|'week'|'work_week'|'day'|'agenda')
* @View
['month', 'week', 'day', 'agenda']
*/
@@ -377,7 +377,7 @@ class Calendar extends React.Component {
* Set to `null` to disable drill-down actions.
*
* ```js
- *
* ```
@@ -392,7 +392,7 @@ class Calendar extends React.Component {
* Return `null` to disable drill-down actions.
*
* ```js
- *
* if (currentViewName === 'month' && configuredViewNames.includes('week'))
* return 'week'
@@ -424,8 +424,8 @@ class Calendar extends React.Component {
* Distance in pixels, from the edges of the viewport, the "show more" overlay should be positioned.
*
* ```jsx
- *
- *
+ *
+ *
* ```
*/
popupOffset: PropTypes.oneOfType([
diff --git a/src/addons/dragAndDrop/README.md b/src/addons/dragAndDrop/README.md
index 76a4825c8..0fa1ab6a1 100644
--- a/src/addons/dragAndDrop/README.md
+++ b/src/addons/dragAndDrop/README.md
@@ -1,12 +1,12 @@
### Drag and Drop
```js
-import BigCalendar from 'react-big-calendar'
+import { Calendar } from 'react-big-calendar'
import withDragAndDrop from 'react-big-calendar/lib/addons/dragAndDrop'
import 'react-big-calendar/lib/addons/dragAndDrop/styles.css'
-const DraggableCalendar = withDragAndDrop(BigCalendar)
+const DraggableCalendar = withDragAndDrop(Calendar)
/* ... */
diff --git a/stories/Calendar.js b/stories/Calendar.js
index 8be67e0c1..bad4e4f98 100644
--- a/stories/Calendar.js
+++ b/stories/Calendar.js
@@ -10,7 +10,7 @@ import demoEvents from '../examples/events'
import createEvents from './helpers/createEvents'
import customComponents from './helpers/customComponents'
-import { events, Calendar } from './helpers'
+import { events, Views, Calendar } from './helpers'
storiesOf('Big Calendar', module)
.add('demo', () => (
@@ -24,7 +24,7 @@ storiesOf('Big Calendar', module)
.add('default view', () => {
return (
{
return (
@@ -111,11 +111,7 @@ storiesOf('Big Calendar', module)
.add('agenda view - with length prop', () => {
return (
/* should display as title toolbar (from now to now + 14 days) */
-
+
)
})
.add('custom now is the first of the month', () => {
@@ -126,7 +122,7 @@ storiesOf('Big Calendar', module)
}
return (
{
return (
{
return (
{
return (
{
return (
{
return (
{
return (
{
return (
{
return (
{
return (
{
return (
{
return (
{
return (
{
return (
moment('9:30am', 'h:mma').toDate()}
diff --git a/stories/helpers/index.js b/stories/helpers/index.js
index 7eee8f5ad..f40ebf09d 100644
--- a/stories/helpers/index.js
+++ b/stories/helpers/index.js
@@ -4,8 +4,7 @@ import { action } from '@storybook/addon-actions'
import moment from 'moment'
import React from 'react'
-import BaseCalendar from '../../src'
-import momentLocalizer from '../../src/localizers/moment.js'
+import { Calendar as BaseCalendar, momentLocalizer } from '../../src'
// For Testing SASS styling
import '../../src/sass/styles.scss'
@@ -13,6 +12,8 @@ import '../../src/addons/dragAndDrop/styles.scss'
import withDragAndDrop from '../../src/addons/dragAndDrop'
+export { Views } from '../../src'
+
addDecorator(function WithHeight(fn) {
return {fn()}
})
@@ -27,8 +28,6 @@ export const Calendar = props => (
)
-Object.assign(Calendar, BaseCalendar)
-
export const DragAndDropCalendar = withDragAndDrop(Calendar)
export const DragableCalendar = props => {