Calendar.jsx 1.12 KB
Newer Older
Zac Wood's avatar
Zac Wood committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
import React from 'react';
import BigCalendar from 'react-big-calendar';
import Toolbar from 'src/Toolbar';
import moment from 'moment';
import '!style-loader!css-loader!react-big-calendar/lib/css/react-big-calendar.css';
import withSizes from 'react-sizes';

const localizer = BigCalendar.momentLocalizer(moment);

const Calendar = props => (
    <div className="full-width" style={{ backgroundColor: 'white', padding: '24px' }}>
        <BigCalendar
            localizer={localizer}
            events={props.events}
            title=""
            components={{ toolbar: Toolbar }}
            defaultView="week"
            views={['week', 'day']}
            startAccessor="start"
            endAccessor="end"
            defaultDate={moment('2019-01-14').toDate()}
            formats={{
                dayFormat: (date, culture, localizer) => localizer.format(date, 'ddd', culture),
                dayHeaderFormat: (date, culture, localizer) => localizer.format(date, 'ddd', culture),
                dayRangeHeaderFormat: () => '',
            }}
            style={{ height: '75vh' }}
        />
    </div>
);

export default Calendar;