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

Function CalendarGrid

starters/hooks/src/Calendar.tsx:48–75  ·  view source on GitHub ↗
({state, ...props}: AriaCalendarGridProps & {state: CalendarState})

Source from the content-addressed store, hash-verified

46}
47
48function CalendarGrid({state, ...props}: AriaCalendarGridProps & {state: CalendarState}) {
49 let {gridProps, headerProps, weekDays, weeksInMonth} = useCalendarGrid(props, state);
50
51 return (
52 <table {...gridProps} className="react-aria-CalendarGrid">
53 <thead {...headerProps}>
54 <tr>
55 {weekDays.map((day, i) => (
56 <th className="react-aria-CalendarHeaderCell" key={i}>
57 {day}
58 </th>
59 ))}
60 </tr>
61 </thead>
62 <tbody>
63 {[...new Array(weeksInMonth).keys()].map(weekIndex => (
64 <tr key={weekIndex}>
65 {state
66 .getDatesInWeek(weekIndex)
67 .map((date, i) =>
68 date ? <CalendarCell key={i} state={state} date={date} /> : <td key={i} />
69 )}
70 </tr>
71 ))}
72 </tbody>
73 </table>
74 );
75}
76
77function CalendarCell({state, date}: {state: CalendarState; date: CalendarDate}) {
78 let ref = useRef<HTMLDivElement>(null);

Callers

nothing calls this directly

Calls 2

useCalendarGridFunction · 0.90
getDatesInWeekMethod · 0.80

Tested by

no test coverage detected