({errorMessage, ...props}: CalendarProps<T>)
| 19 | } |
| 20 | |
| 21 | export function Calendar<T extends DateValue>({errorMessage, ...props}: CalendarProps<T>) { |
| 22 | let months = props.visibleDuration?.months || 1; |
| 23 | return ( |
| 24 | <AriaCalendar {...props}> |
| 25 | <div className="months"> |
| 26 | {Array.from({length: months}, (_, i) => ( |
| 27 | <div key={i} className="month"> |
| 28 | <header> |
| 29 | {i === 0 && ( |
| 30 | <Button slot="previous" variant="quiet"> |
| 31 | <ChevronLeft /> |
| 32 | </Button> |
| 33 | )} |
| 34 | <CalendarHeading offset={{months: i}} /> |
| 35 | {i === months - 1 && ( |
| 36 | <Button slot="next" variant="quiet"> |
| 37 | <ChevronRight /> |
| 38 | </Button> |
| 39 | )} |
| 40 | </header> |
| 41 | <CalendarGrid offset={{months: i}}>{date => <CalendarCell date={date} />}</CalendarGrid> |
| 42 | </div> |
| 43 | ))} |
| 44 | </div> |
| 45 | {errorMessage && <Text slot="errorMessage">{errorMessage}</Text>} |
| 46 | </AriaCalendar> |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | export function CalendarCell(props: CalendarCellProps) { |
| 51 | return ( |
nothing calls this directly
no outgoing calls
no test coverage detected