MCPcopy Index your code
hub / github.com/adobe/react-spectrum / Cell

Function Cell

packages/react-aria/stories/calendar/Example.tsx:116–141  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

114}
115
116function Cell(props) {
117 let ref = useRef<HTMLSpanElement | null>(null);
118 let {cellProps, buttonProps} = useCalendarCell(props, props.state, ref);
119
120 let dateFormatter = useDateFormatter({
121 day: 'numeric',
122 timeZone: props.state.timeZone,
123 calendar: props.date.calendar.identifier
124 });
125
126 return (
127 <div {...cellProps} style={{display: 'inline-block'}}>
128 <span
129 ref={ref}
130 {...buttonProps}
131 style={{
132 display: 'block',
133 width: 42,
134 height: 42,
135 background: props.state.isSelected(props.date) ? 'blue' : ''
136 }}>
137 {dateFormatter.format(props.date.toDate(props.state.timeZone))}
138 </span>
139 </div>
140 );
141}
142
143export function ExampleCustomFirstDay(props: AriaCalendarProps<DateValue>): JSX.Element {
144 let {locale} = useLocale();

Callers

nothing calls this directly

Calls 5

useCalendarCellFunction · 0.90
useDateFormatterFunction · 0.90
isSelectedMethod · 0.65
formatMethod · 0.45
toDateMethod · 0.45

Tested by

no test coverage detected