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

Version 2.0 #73

Merged
merged 36 commits into from
Feb 25, 2017
Merged

Version 2.0 #73

merged 36 commits into from
Feb 25, 2017

Conversation

clauderic
Copy link
Owner

@clauderic clauderic commented Feb 19, 2017

If you'd like to test version 2 ahead of it's release, run npm install react-infinite-calendar@next

This version focuses on initial render performance, extensibility through composition, bundle size and fixing bugs related to outdated dependencies.

Composition

The codebase has been heavily refactored to make way for composable Higher Order Components that will help add opt-in layers of functionality. Out of the box, react-infinite-calendar 2.0 will come with the following HOCs: withDateSelection, withDateRangeSelection, withMultipleDateSelection and withKeyboardSupport.

The idea here is that users will also be able to write their own HOCs to enhance react-infinite-calendar to suit their needs if their use-case doesn't fit in the scope of the project.

Here's a simplified example implementing multiple date selection:

screen shot 2017-02-21 at 6 56 26 pm

screen shot 2017-02-21 at 6 53 12 pm

Moment.js -->date-fns

Dependency on Moment.js and moment-range has been dropped in favor of date-fns. This results in a much smaller bundle, as date-fns allows cherry-picking the methods we need and only comes bundled with the en locale by default.

The project has also been converted to use the nwb tooling for development and to manage the creation of the ES6, ES5 and UMD builds.

Bug fixes and improvements:

The following issues will be addressed with version 2.0:

Backwards-breaking changes

Moment.js replaced with date-fns

If you were using a custom locale with version 1.0, you'll need to take a look at the new default locale and update your locale configuration. If you're planning on using a locale other than en, you'll also need to import that locale (refer to date-fns I18n documentation for more details) and pass it as a property of the locale prop. For example, if you wanted to add support for the fr locale:

<InfiniteCalendar
  locale={{
    blank: 'Aucune date sélectionnée',
    headerFormat: 'dddd, D MMM',
    locale: require('date-fns/locale/fr'),
    todayLabel: {
      long: "Aujourd'hui",
      short: 'Auj.',
    },
    weekdays: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
  }}
/>

Supported React Versions

Supported React versions have changed. Previously all React 14 and 15 releases were supported. Going forward only React 15.3 and newer will be supported. This was done in order to drop a peer dependency on react-addons-shallow-compare and replace it with React.PureComponent, as the docs suggest.

screen shot 2017-02-13 at 1 44 43 pm

Display Options

Finally, display options have also been consolidated under the displayOptions prop:

Property Type Default Description
layout String 'portrait' Layout of the calendar. Should be one of 'portrait' or 'landscape'
showHeader Boolean true Show/hide the header
shouldHeaderAnimate Boolean true Enable/Disable the header animation
showOverlay Boolean true Show/hide the month overlay when scrolling
showTodayHelper Boolean true Show/hide the floating back to Today helper
hideYearsOnSelect Boolean true Whether to automatically hide the years view on select.
overscanMonthCount Number 4 Number of months to render above/below the visible months. Tweaking this can help reduce flickering during scrolling on certain browers/devices.
todayHelperRowOffset Number 4 This controls the number of rows to scroll past before the Today helper appears

Example usage of display options:

<InfiniteCalendar
  displayOptions={{
    layout: 'landscape',
    showOverlay: false,
    shouldHeaderAnimate: false
  }}
/>

For more details, check out the defaultDisplayOptions file.

Storybook

And finally, react-storybook has been added and all of the examples from the demo site have been added. Clone the repo locally and run npm run storybook to check it out.

@clauderic clauderic mentioned this pull request Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant