Skip to content

Commit

Permalink
feat: provide named exports api (jquense#1348)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: must use named exports for additional RBC imports

```js
import {
  Calendar,
  DateLocalizer,
  momentLocalizer,
  globalizeLocalizer,
  move,
  Views,
  Navigate,
  components
} from 'react-big-calendar';
```
  • Loading branch information
TrySound authored and jquense committed Jun 10, 2019
1 parent e704e17 commit 4e09704
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 37 deletions.
22 changes: 11 additions & 11 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"./dist/react-big-calendar.js": {
"bundled": 553987,
"minified": 170205,
"gzipped": 50025
"bundled": 554087,
"minified": 170209,
"gzipped": 49950
},
"./dist/react-big-calendar.min.js": {
"bundled": 490228,
"minified": 150810,
"gzipped": 45487
"bundled": 490328,
"minified": 150824,
"gzipped": 45415
},
"dist/react-big-calendar.esm.js": {
"bundled": 169712,
"minified": 81562,
"gzipped": 20075,
"bundled": 169648,
"minified": 81524,
"gzipped": 20082,
"treeshaked": {
"rollup": {
"code": 62970,
"code": 59035,
"import_statements": 1402
},
"webpack": {
"code": 66409
"code": 62470
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ Regardless of your choice, you **must** choose a localizer to use this library:
#### Moment.js

```js
import BigCalendar from 'react-big-calendar'
import { Calendar, momentLocalizer } from 'react-big-calendar'
import moment from 'moment'

const localizer = BigCalendar.momentLocalizer(moment)
const localizer = momentLocalizer(moment)

const MyCalendar = props => (
<div>
<BigCalendar
<Calendar
localizer={localizer}
events={myEventsList}
startAccessor="start"
Expand All @@ -59,14 +59,14 @@ const MyCalendar = props => (
#### Globalize.js v0.1.1

```js
import BigCalendar from 'react-big-calendar'
import { Calendar, globalizeLocalizer } from 'react-big-calendar'
import globalize from 'globalize'

const localizer = BigCalendar.globalizeLocalizer(globalize)
const localizer = globalizeLocalizer(globalize)

const MyCalendar = props => (
<div>
<BigCalendar
<Calendar
localizer={localizer}
events={myEventsList}
startAccessor="start"
Expand Down
31 changes: 11 additions & 20 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
import Calendar from './Calendar'
import EventWrapper from './EventWrapper'
import BackgroundWrapper from './BackgroundWrapper'
import { DateLocalizer } from './localizer'
import momentLocalizer from './localizers/moment'
import globalizeLocalizer from './localizers/globalize'
import move from './utils/move'
import { views, navigate } from './utils/constants'

Object.assign(Calendar, {
DateLocalizer,
globalizeLocalizer,
momentLocalizer,
Views: views,
Navigate: navigate,
move,
components: {
eventWrapper: EventWrapper,
timeSlotWrapper: BackgroundWrapper,
dateCellWrapper: BackgroundWrapper,
},
})
export const components = {
eventWrapper: EventWrapper,
timeSlotWrapper: BackgroundWrapper,
dateCellWrapper: BackgroundWrapper,
}

export default Calendar
export { default as Calendar } from './Calendar'
export { DateLocalizer } from './localizer'
export { default as momentLocalizer } from './localizers/moment'
export { default as globalizeLocalizer } from './localizers/globalize'
export { default as move } from './utils/move'
export { views as Views, navigate as Navigate } from './utils/constants'

0 comments on commit 4e09704

Please sign in to comment.