You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
972 B
46 lines
972 B
import PropTypes from 'prop-types';
|
|
import React, { Component } from 'react';
|
|
import * as calendarViews from 'Calendar/calendarViews';
|
|
import Button from 'Components/Link/Button';
|
|
import titleCase from 'Utilities/String/titleCase';
|
|
// import styles from './CalendarHeaderViewButton.css';
|
|
|
|
class CalendarHeaderViewButton extends Component {
|
|
|
|
//
|
|
// Listeners
|
|
|
|
onPress = () => {
|
|
this.props.onPress(this.props.view);
|
|
}
|
|
|
|
//
|
|
// Render
|
|
|
|
render() {
|
|
const {
|
|
view,
|
|
selectedView,
|
|
...otherProps
|
|
} = this.props;
|
|
|
|
return (
|
|
<Button
|
|
isDisabled={selectedView === view}
|
|
{...otherProps}
|
|
onPress={this.onPress}
|
|
>
|
|
{titleCase(view)}
|
|
</Button>
|
|
);
|
|
}
|
|
}
|
|
|
|
CalendarHeaderViewButton.propTypes = {
|
|
view: PropTypes.oneOf(calendarViews.all).isRequired,
|
|
selectedView: PropTypes.oneOf(calendarViews.all).isRequired,
|
|
onPress: PropTypes.func.isRequired
|
|
};
|
|
|
|
export default CalendarHeaderViewButton;
|