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

Function ReorderFixture

perf/app/workflows.tsx:112–139  ·  view source on GitHub ↗
({items}: {items: RecordItem[]})

Source from the content-addressed store, hash-verified

110}
111
112export function ReorderFixture({items}: {items: RecordItem[]}) {
113 let [rows, setRows] = useState(items);
114 let {dragAndDropHooks} = useDragAndDrop({
115 getItems: keys => [...keys].map(key => ({'text/plain': String(key)})),
116 onReorder: ({keys, target}) => setRows(rows => moveRecords(rows, keys, target))
117 });
118 return (
119 <GridList
120 aria-label="Reorderable records"
121 className="reorder-list"
122 items={rows}
123 dragAndDropHooks={dragAndDropHooks}>
124 {item => (
125 <GridListItem id={item.id} data-record={item.id} textValue={item.name}>
126 <div className="reorder-content">
127 <Button slot="drag" aria-label={`Drag ${item.name}`}>
128 ≡
129 </Button>
130 <Text data-record-label>{item.name}</Text>
131 <Text slot="description">
132 {item.owner} · {item.status}
133 </Text>
134 </div>
135 </GridListItem>
136 )}
137 </GridList>
138 );
139}

Callers

nothing calls this directly

Calls 3

useDragAndDropFunction · 0.90
StringFunction · 0.85
moveRecordsFunction · 0.85

Tested by

no test coverage detected