Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 100x 100x 100x 700x 700x | /** @jsx createElement */
import {Duration} from 'luxon'
import {Component} from 'react'
import PropTypes from 'prop-types'
import createElementWithOverride from '../Utilities/createElementWithOverride'
import CalendarDay from './CalendarDay'
/**
* Component representing one week of the calendar. It starts at props.firstDay
* and loops through the seven days of the week, creating seven `CalendarDay`s.
*/
class CalendarWeekRow extends Component {
static propTypes = {
currentMonth: PropTypes.string,
dateChanger: PropTypes.func,
highlights: PropTypes.oneOfType([
PropTypes.array,
PropTypes.func,
PropTypes.object,
]),
isSelectable: PropTypes.func,
overrides: PropTypes.object,
selectedDate: PropTypes.any,
day: PropTypes.any,
week: PropTypes.any,
firstDay: PropTypes.any,
}
render() {
const {
currentMonth,
dateChanger,
day,
highlights,
isSelectable,
overrides,
selectedDate,
firstDay,
...rowProps
} = this.props
const createElement = createElementWithOverride.bind(this, overrides)
return (
<tr {...rowProps}>
{[0, 1, 2, 3, 4, 5, 6].map((i) => {
const date = firstDay.plus(Duration.fromObject({days: i}))
return (
<CalendarDay
currentMonth={currentMonth}
dateChanger={dateChanger}
highlights={highlights}
isSelectable={isSelectable}
overrides={overrides}
selectedDate={selectedDate}
{...day}
date={date}
key={date.toISO()}
/>
)
})}
</tr>
)
}
}
export default CalendarWeekRow
|