Skip to content

Commit

Permalink
change examples to use stateless fn components
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Sep 13, 2015
1 parent 411332e commit 6cab749
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
12 changes: 4 additions & 8 deletions examples/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@ setLocalizer(
globalizeLocalizer(globalize)
);

class EventWeek {
render(){
return <strong>{this.props.event.title}</strong>
}
function EventWeek(props) {
return <strong>{props.event.title}</strong>
}

class EventAgenda {
render(){
return <em>{this.props.event.title}</em>
}
function EventAgenda(props) {
return <em>{props.event.title}</em>
}

const Example = React.createClass({
Expand Down
3 changes: 1 addition & 2 deletions src/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ let Calendar = React.createClass({
formats = defaultFormats(formats)

let View = VIEWS[view];
let label = viewLabel(current, view, formats, culture)
let names = viewNames(this.props.views)

let elementProps = omit(this.props, Object.keys(Calendar.propTypes))
Expand All @@ -234,7 +233,7 @@ let Calendar = React.createClass({
date={current}
view={view}
views={names}
label={label}
label={viewLabel(current, view, formats, culture)}
onViewChange={this._view}
onNavigate={this._navigate}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/EventRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ let propTypes = {
};


let MonthView = React.createClass({
let EventRow = React.createClass({

displayName: 'MonthView',
displayName: 'EventRow',

propTypes,

Expand Down Expand Up @@ -100,4 +100,4 @@ let MonthView = React.createClass({
}
});

export default MonthView
export default EventRow
2 changes: 1 addition & 1 deletion src/Popup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import EventCell from './EventCell';
import { isSelected } from './utils/selection';

class Popup {
class Popup extends React.Component {
render() {
let { events, selected, ...props } = this.props;

Expand Down
2 changes: 1 addition & 1 deletion src/Week.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let Week = React.createClass({
propTypes: TimeGrid.propTypes,

render() {
let { date, culture } = this.props
let { date } = this.props
let { start, end } = Week.range(date, this.props)

return (
Expand Down

0 comments on commit 6cab749

Please sign in to comment.