MCPcopy Create free account
hub / github.com/adobe/react-spectrum / CalendarGrid

Function CalendarGrid

starters/hooks/src/RangeCalendar.tsx:58–85  ·  view source on GitHub ↗
({state, ...props}: AriaCalendarGridProps & {state: RangeCalendarState})

Source from the content-addressed store, hash-verified

56}
57
58function 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
87function CalendarCell({state, date}: {state: RangeCalendarState; date: CalendarDate}) {
88 let ref = useRef<HTMLDivElement>(null);

Callers

nothing calls this directly

Calls 2

useCalendarGridFunction · 0.85
getDatesInWeekMethod · 0.80

Tested by

no test coverage detected