import React from 'react';
import BigCalendar from 'react-big-calendar';
import Toolbar from 'react-big-calendar/lib/Toolbar';
import '!style-loader!css-loader!react-big-calendar/lib/css/react-big-calendar.css';
import withSizes from 'react-sizes';
class CustomToolbar extends Toolbar {
render() {
const { label, isMobile } = this.props;
if (isMobile && label === '') {
this.view('day');
}
return (
{!isMobile && (
)}
{this.props.label}
{this.props.view === 'day' && (
{this.props.label !== 'Sun' && (
)}
{this.props.label !== 'Sat' && (
)}
)}
);
}
navigate = action => {
this.props.onNavigate(action);
};
view = action => {
this.props.onView(action);
};
}
const mapSizesToProps = ({ width }) => ({
isMobile: width < 1000,
});
export default withSizes(mapSizesToProps)(CustomToolbar);