({ items, isLoading, error, nextPage, previousPage, onSelect })
| 20 | }; |
| 21 | |
| 22 | function ItemList({ items, isLoading, error, nextPage, previousPage, onSelect }) { |
| 23 | return ( |
| 24 | <Panel className="grid grid-rows-[1fr_min-content] p-4"> |
| 25 | <div className="overflow-x-clip"> |
| 26 | <H2>Item List</H2> |
| 27 | {isLoading && <p>Loading...</p>} |
| 28 | {error && <p>{error}</p>} |
| 29 | {items && ( |
| 30 | <ul className="space-y-2"> |
| 31 | {items.features.map((item) => ( |
| 32 | <li key={item.id}> |
| 33 | <button onClick={onSelect(item)} className="text-pretty"> |
| 34 | {item.id} |
| 35 | </button> |
| 36 | </li> |
| 37 | ))} |
| 38 | </ul> |
| 39 | )} |
| 40 | </div> |
| 41 | <div className="grid grid-cols-2 gap-4"> |
| 42 | <PaginationButton disabled={!previousPage} onClick={previousPage}> |
| 43 | Previous page |
| 44 | </PaginationButton> |
| 45 | <PaginationButton disabled={!nextPage} onClick={nextPage}> |
| 46 | Next page |
| 47 | </PaginationButton> |
| 48 | </div> |
| 49 | </Panel> |
| 50 | ); |
| 51 | } |
| 52 | |
| 53 | ItemList.propTypes = { |
| 54 | items: TItemList, |
nothing calls this directly
no outgoing calls
no test coverage detected