({state, ...props}: AriaCalendarGridProps & {state: RangeCalendarState})
| 56 | } |
| 57 | |
| 58 | function CalendarGrid({state, ...props}: AriaCalendarGridProps & {state: RangeCalendarState}) { |
| 59 | let {gridProps, headerProps, weekDays, weeksInMonth} = useCalendarGrid(props, state); |
| 60 | |
| 61 | return ( |
| 62 | <table {...gridProps} className="react-aria-CalendarGrid"> |
| 63 | <thead {...headerProps}> |
| 64 | <tr> |
| 65 | {weekDays.map((day, i) => ( |
| 66 | <th className="react-aria-CalendarHeaderCell" key={i}> |
| 67 | {day} |
| 68 | </th> |
| 69 | ))} |
| 70 | </tr> |
| 71 | </thead> |
| 72 | <tbody> |
| 73 | {[...new Array(weeksInMonth).keys()].map(weekIndex => ( |
| 74 | <tr key={weekIndex}> |
| 75 | {state |
| 76 | .getDatesInWeek(weekIndex) |
| 77 | .map((date, i) => |
| 78 | date ? <CalendarCell key={i} state={state} date={date} /> : <td key={i} /> |
| 79 | )} |
| 80 | </tr> |
| 81 | ))} |
| 82 | </tbody> |
| 83 | </table> |
| 84 | ); |
| 85 | } |
| 86 | |
| 87 | function CalendarCell({state, date}: {state: RangeCalendarState; date: CalendarDate}) { |
| 88 | let ref = useRef<HTMLDivElement>(null); |
nothing calls this directly
no test coverage detected