Skip to content

Commit

Permalink
Switch to classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed May 2, 2017
1 parent 92c1f04 commit 9564cb0
Show file tree
Hide file tree
Showing 10 changed files with 815 additions and 851 deletions.
35 changes: 16 additions & 19 deletions src/Agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import { accessor, dateFormat, dateRangeFormat } from './utils/propTypes';
import { inRange } from './utils/eventLevels';


let Agenda = React.createClass({

propTypes: {
class Agenda extends React.Component {
static propTypes = {
events: PropTypes.array,
date: PropTypes.instanceOf(Date),
length: PropTypes.number.isRequired,
Expand All @@ -34,21 +33,19 @@ let Agenda = React.createClass({
date: PropTypes.string,
time: PropTypes.string,
})
},
};

getDefaultProps() {
return {
length: 30
};
},
static defaultProps = {
length: 30
};

componentDidMount() {
this._adjustHeader()
},
}

componentDidUpdate() {
this._adjustHeader()
},
}

render() {
let { length, date, events, startAccessor } = this.props;
Expand Down Expand Up @@ -89,9 +86,9 @@ let Agenda = React.createClass({
</div>
</div>
);
},
}

renderDay(day, events, dayKey){
renderDay = (day, events, dayKey) => {
let {
culture, components
, titleAccessor, agendaDateFormat } = this.props;
Expand Down Expand Up @@ -130,9 +127,9 @@ let Agenda = React.createClass({
</tr>
)
}, [])
},
};

timeRangeLabel(day, event){
timeRangeLabel = (day, event) => {
let {
endAccessor, startAccessor, allDayAccessor
, culture, messages, components } = this.props;
Expand Down Expand Up @@ -167,9 +164,9 @@ let Agenda = React.createClass({
}
</span>
)
},
};

_adjustHeader() {
_adjustHeader = () => {
let header = this.refs.header;
let firstRow = this.refs.tbody.firstChild

Expand All @@ -196,8 +193,8 @@ let Agenda = React.createClass({
else {
classes.removeClass(header, 'rbc-header-overflowing')
}
}
});
};
}

Agenda.navigate = (date, action)=>{
switch (action){
Expand Down
Loading

0 comments on commit 9564cb0

Please sign in to comment.