| 1 |
import { Fragment, useState } from 'react'; |
| 2 |
import { |
| 3 |
Badge, |
| 4 |
Bullseye, |
| 5 |
Button, |
| 6 |
Card, |
| 7 |
CardHeader, |
| 8 |
CardTitle, |
| 9 |
CardBody, |
| 10 |
Content, |
| 11 |
Divider, |
| 12 |
Dropdown, |
| 13 |
DropdownItem, |
| 14 |
DropdownList, |
| 15 |
EmptyState, |
| 16 |
EmptyStateFooter, |
| 17 |
EmptyStateVariant, |
| 18 |
EmptyStateActions, |
| 19 |
Gallery, |
| 20 |
MenuToggle, |
| 21 |
MenuToggleCheckbox, |
| 22 |
OverflowMenu, |
| 23 |
OverflowMenuControl, |
| 24 |
OverflowMenuDropdownItem, |
| 25 |
OverflowMenuItem, |
| 26 |
PageSection, |
| 27 |
Pagination, |
| 28 |
Toolbar, |
| 29 |
ToolbarItem, |
| 30 |
ToolbarFilter, |
| 31 |
ToolbarContent, |
| 32 |
Select, |
| 33 |
SelectList, |
| 34 |
SelectOption, |
| 35 |
MenuToggleElement |
| 36 |
} from '@patternfly/react-core'; |
| 37 |
import TrashIcon from '@patternfly/react-icons/dist/esm/icons/trash-icon'; |
| 38 |
import RhUiAddCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-add-circle-fill-icon'; |
| 39 |
import pfIcon from './assets/pf-logo-small.svg'; |
| 40 |
import activeMQIcon from './assets/activemq-core_200x150.png'; |
| 41 |
import avroIcon from './assets/camel-avro_200x150.png'; |
| 42 |
import dropBoxIcon from './assets/camel-dropbox_200x150.png'; |
| 43 |
import infinispanIcon from './assets/camel-infinispan_200x150.png'; |
| 44 |
import saxonIcon from './assets/camel-saxon_200x150.png'; |
| 45 |
import sparkIcon from './assets/camel-spark_200x150.png'; |
| 46 |
import swaggerIcon from './assets/camel-swagger-java_200x150.png'; |
| 47 |
import azureIcon from './assets/FuseConnector_Icons_AzureServices.png'; |
| 48 |
import restIcon from './assets/FuseConnector_Icons_REST.png'; |
| 49 |
import RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon'; |
| 50 |
import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper'; |
| 51 |
import { data } from '@patternfly/react-core/src/demos/CardView/examples/CardViewData.jsx'; |
| 52 |
|
| 53 |
export const CardViewBasic: React.FunctionComponent = () => { |
| 54 |
const totalItemCount = 10; |
| 55 |
|
| 56 |
const [cardData, setCardData] = useState(data); |
| 57 |
const [isChecked, setIsChecked] = useState(false); |
| 58 |
const [selectedItems, setSelectedItems] = useState<number[]>([]); |
| 59 |
const [areAllSelected, setAreAllSelected] = useState<boolean>(false); |
| 60 |
const [splitButtonDropdownIsOpen, setSplitButtonDropdownIsOpen] = useState(false); |
| 61 |
const [isLowerToolbarDropdownOpen, setIsLowerToolbarDropdownOpen] = useState(false); |
| 62 |
const [isLowerToolbarKebabDropdownOpen, setIsLowerToolbarKebabDropdownOpen] = useState(false); |
| 63 |
const [page, setPage] = useState(1); |
| 64 |
const [perPage, setPerPage] = useState(10); |
| 65 |
const [filters, setFilters] = useState<Record<string, string[]>>({ products: [] }); |
| 66 |
const [state, setState] = useState({}); |
| 67 |
|
| 68 |
interface ProductType { |
| 69 |
id: number; |
| 70 |
name: string; |
| 71 |
icon: string; |
| 72 |
description: string; |
| 73 |
} |
| 74 |
const checkAllSelected = (selected: number, total: number) => { |
| 75 |
if (selected && selected < total) { |
| 76 |
return null; |
| 77 |
} |
| 78 |
return selected === total; |
| 79 |
}; |
| 80 |
|
| 81 |
const onToolbarDropdownToggle = () => { |
| 82 |
setIsLowerToolbarDropdownOpen(!isLowerToolbarDropdownOpen); |
| 83 |
}; |
| 84 |
|
| 85 |
const onToolbarKebabDropdownToggle = () => { |
| 86 |
setIsLowerToolbarKebabDropdownOpen(!isLowerToolbarKebabDropdownOpen); |
| 87 |
}; |
| 88 |
|
| 89 |
const onToolbarKebabDropdownSelect = () => { |
| 90 |
setIsLowerToolbarKebabDropdownOpen(!isLowerToolbarKebabDropdownOpen); |
| 91 |
}; |
| 92 |
|
| 93 |
const onCardKebabDropdownToggle = ( |
| 94 |
event: React.MouseEvent<HTMLButtonElement, MouseEvent> | React.MouseEvent<HTMLDivElement, MouseEvent>, |
| 95 |
key: string |
| 96 |
) => { |
| 97 |
setState({ |
| 98 |
[key]: !state[key as keyof Object] |
| 99 |
}); |
| 100 |
}; |
| 101 |
|
| 102 |
const deleteItem = (item: ProductType) => { |
| 103 |
const filter = (getter) => (val) => getter(val) !== item.id; |
| 104 |
|
| 105 |
setCardData(cardData.filter(filter(({ id }) => id))); |
| 106 |
|
| 107 |
setSelectedItems(selectedItems.filter(filter((id) => id))); |
| 108 |
}; |
| 109 |
|
| 110 |
const onSetPage = (_event: any, pageNumber: number) => { |
| 111 |
setPage(pageNumber); |
| 112 |
}; |
| 113 |
|
| 114 |
const onPerPageSelect = (_event: any, perPage: number) => { |
| 115 |
setPerPage(perPage); |
| 116 |
setPage(1); |
| 117 |
}; |
| 118 |
|
| 119 |
const onSplitButtonToggle = () => { |
| 120 |
setSplitButtonDropdownIsOpen(!splitButtonDropdownIsOpen); |
| 121 |
}; |
| 122 |
|
| 123 |
const onSplitButtonSelect = () => { |
| 124 |
setSplitButtonDropdownIsOpen(false); |
| 125 |
}; |
| 126 |
|
| 127 |
const onNameSelect = (event: any, selection = '') => { |
| 128 |
const checked = event.target.checked; |
| 129 |
const prevSelections = filters.products; |
| 130 |
|
| 131 |
setFilters({ |
| 132 |
...filters, |
| 133 |
products: checked ? [...prevSelections, selection] : prevSelections.filter((value) => value !== selection) |
| 134 |
}); |
| 135 |
}; |
| 136 |
|
| 137 |
const onDelete = (type = '', _id = '') => { |
| 138 |
if (type) { |
| 139 |
setFilters(filters); |
| 140 |
} else { |
| 141 |
setFilters({ products: [] }); |
| 142 |
} |
| 143 |
}; |
| 144 |
|
| 145 |
const onChange = (event: React.FormEvent<HTMLInputElement>) => { |
| 146 |
const name = event.currentTarget.name; |
| 147 |
const productId = Number(name.charAt(name.length - 1)); |
| 148 |
|
| 149 |
if (selectedItems.includes(productId * 1)) { |
| 150 |
setSelectedItems(selectedItems.filter((id) => productId * 1 !== id)); |
| 151 |
|
| 152 |
const checkAll = checkAllSelected(selectedItems.length - 1, totalItemCount); |
| 153 |
setAreAllSelected(!!checkAll); |
| 154 |
} else { |
| 155 |
setSelectedItems([...selectedItems, productId * 1]); |
| 156 |
const checkAll = checkAllSelected(selectedItems.length + 1, totalItemCount); |
| 157 |
setAreAllSelected(!!checkAll); |
| 158 |
} |
| 159 |
}; |
| 160 |
|
| 161 |
const updateSelected = () => { |
| 162 |
const rows = cardData.map((post) => { |
| 163 |
post.selected = selectedItems.includes(post.id); |
| 164 |
return post; |
| 165 |
}); |
| 166 |
|
| 167 |
setCardData(rows); |
| 168 |
}; |
| 169 |
|
| 170 |
const getAllItems = () => { |
| 171 |
const collection: number[] = []; |
| 172 |
for (const items of cardData) { |
| 173 |
collection.push(items.id); |
| 174 |
} |
| 175 |
|
| 176 |
return collection; |
| 177 |
}; |
| 178 |
|
| 179 |
const splitCheckboxSelectAll = (e: any) => { |
| 180 |
let collection: number[] = []; |
| 181 |
|
| 182 |
if (e.target.checked) { |
| 183 |
for (let i = 0; i <= 9; i++) { |
| 184 |
collection = [...collection, i]; |
| 185 |
} |
| 186 |
} |
| 187 |
|
| 188 |
setSelectedItems(collection); |
| 189 |
setIsChecked(isChecked); |
| 190 |
setAreAllSelected(e.target.checked); |
| 191 |
|
| 192 |
updateSelected(); |
| 193 |
}; |
| 194 |
|
| 195 |
const selectPage = (e: { target: { checked: any } }) => { |
| 196 |
const { checked } = e.target; |
| 197 |
let collection: number[] = []; |
| 198 |
|
| 199 |
collection = getAllItems(); |
| 200 |
|
| 201 |
setSelectedItems(collection); |
| 202 |
setIsChecked(checked); |
| 203 |
setAreAllSelected(totalItemCount === perPage ? true : false); |
| 204 |
|
| 205 |
updateSelected(); |
| 206 |
}; |
| 207 |
|
| 208 |
const selectAll = () => { |
| 209 |
let collection: number[] = []; |
| 210 |
for (let i = 0; i <= 9; i++) { |
| 211 |
collection = [...collection, i]; |
| 212 |
} |
| 213 |
|
| 214 |
setSelectedItems(collection); |
| 215 |
setIsChecked(true); |
| 216 |
setAreAllSelected(true); |
| 217 |
|
| 218 |
updateSelected(); |
| 219 |
}; |
| 220 |
|
| 221 |
const selectNone = () => { |
| 222 |
setSelectedItems([]); |
| 223 |
setIsChecked(false); |
| 224 |
setAreAllSelected(false); |
| 225 |
|
| 226 |
updateSelected(); |
| 227 |
}; |
| 228 |
|
| 229 |
const renderPagination = () => { |
| 230 |
const defaultPerPageOptions = [ |
| 231 |
{ |
| 232 |
title: '1', |
| 233 |
value: 1 |
| 234 |
}, |
| 235 |
{ |
| 236 |
title: '5', |
| 237 |
value: 5 |
| 238 |
}, |
| 239 |
{ |
| 240 |
title: '10', |
| 241 |
value: 10 |
| 242 |
} |
| 243 |
]; |
| 244 |
|
| 245 |
return ( |
| 246 |
<Pagination |
| 247 |
itemCount={totalItemCount} |
| 248 |
page={page} |
| 249 |
perPage={perPage} |
| 250 |
perPageOptions={defaultPerPageOptions} |
| 251 |
onSetPage={onSetPage} |
| 252 |
onPerPageSelect={onPerPageSelect} |
| 253 |
variant="top" |
| 254 |
isCompact |
| 255 |
/> |
| 256 |
); |
| 257 |
}; |
| 258 |
|
| 259 |
const buildSelectDropdown = () => { |
| 260 |
const numSelected = selectedItems.length; |
| 261 |
const anySelected = numSelected > 0; |
| 262 |
const splitButtonDropdownItems = ( |
| 263 |
<> |
| 264 |
<DropdownItem key="item-1" onClick={selectNone}> |
| 265 |
Select none (0 items) |
| 266 |
</DropdownItem> |
| 267 |
<DropdownItem key="item-2" onClick={selectPage}> |
| 268 |
Select page ({perPage} items) |
| 269 |
</DropdownItem> |
| 270 |
<DropdownItem key="item-3" onClick={selectAll}> |
| 271 |
Select all ({totalItemCount} items) |
| 272 |
</DropdownItem> |
| 273 |
</> |
| 274 |
); |
| 275 |
return ( |
| 276 |
<Dropdown |
| 277 |
onSelect={onSplitButtonSelect} |
| 278 |
isOpen={splitButtonDropdownIsOpen} |
| 279 |
onOpenChange={(isOpen) => setSplitButtonDropdownIsOpen(isOpen)} |
| 280 |
toggle={(toggleRef) => ( |
| 281 |
<MenuToggle |
| 282 |
ref={toggleRef} |
| 283 |
isExpanded={splitButtonDropdownIsOpen} |
| 284 |
onClick={onSplitButtonToggle} |
| 285 |
aria-label="Select cards" |
| 286 |
splitButtonItems={[ |
| 287 |
<MenuToggleCheckbox |
| 288 |
id="split-dropdown-checkbox" |
| 289 |
key="split-dropdown-checkbox" |
| 290 |
aria-label={anySelected ? 'Deselect all cards' : 'Select all cards'} |
| 291 |
isChecked={areAllSelected} |
| 292 |
onClick={(e) => splitCheckboxSelectAll(e)} |
| 293 |
> |
| 294 |
{numSelected !== 0 && `${numSelected} selected`} |
| 295 |
</MenuToggleCheckbox> |
| 296 |
]} |
| 297 |
></MenuToggle> |
| 298 |
)} |
| 299 |
> |
| 300 |
<DropdownList>{splitButtonDropdownItems}</DropdownList> |
| 301 |
</Dropdown> |
| 302 |
); |
| 303 |
}; |
| 304 |
|
| 305 |
const buildFilterDropdown = () => { |
| 306 |
const filterDropdownItems = ( |
| 307 |
<SelectList> |
| 308 |
<SelectOption |
| 309 |
hasCheckbox |
| 310 |
key="patternfly" |
| 311 |
value="PatternFly" |
| 312 |
isSelected={filters.products.includes('PatternFly')} |
| 313 |
> |
| 314 |
PatternFly |
| 315 |
</SelectOption> |
| 316 |
<SelectOption hasCheckbox key="activemq" value="ActiveMQ" isSelected={filters.products.includes('ActiveMQ')}> |
| 317 |
ActiveMQ |
| 318 |
</SelectOption> |
| 319 |
<SelectOption |
| 320 |
hasCheckbox |
| 321 |
key="apachespark" |
| 322 |
value="Apache Spark" |
| 323 |
isSelected={filters.products.includes('Apache Spark')} |
| 324 |
> |
| 325 |
Apache Spark |
| 326 |
</SelectOption> |
| 327 |
<SelectOption hasCheckbox key="avro" value="Avro" isSelected={filters.products.includes('Avro')}> |
| 328 |
Avro |
| 329 |
</SelectOption> |
| 330 |
<SelectOption |
| 331 |
hasCheckbox |
| 332 |
key="azureservices" |
| 333 |
value="Azure Services" |
| 334 |
isSelected={filters.products.includes('Azure Services')} |
| 335 |
> |
| 336 |
Azure Services |
| 337 |
</SelectOption> |
| 338 |
<SelectOption hasCheckbox key="crypto" value="Crypto" isSelected={filters.products.includes('Crypto')}> |
| 339 |
Crypto |
| 340 |
</SelectOption> |
| 341 |
<SelectOption hasCheckbox key="dropbox" value="DropBox" isSelected={filters.products.includes('DropBox')}> |
| 342 |
DropBox |
| 343 |
</SelectOption> |
| 344 |
<SelectOption |
| 345 |
hasCheckbox |
| 346 |
key="jbossdatagrid" |
| 347 |
value="JBoss Data Grid" |
| 348 |
isSelected={filters.products.includes('JBoss Data Grid')} |
| 349 |
> |
| 350 |
JBoss Data Grid |
| 351 |
</SelectOption> |
| 352 |
<SelectOption hasCheckbox key="rest" value="REST" isSelected={filters.products.includes('REST')}> |
| 353 |
REST |
| 354 |
</SelectOption> |
| 355 |
<SelectOption hasCheckbox key="swagger" value="SWAGGER" isSelected={filters.products.includes('SWAGGER')}> |
| 356 |
SWAGGER |
| 357 |
</SelectOption> |
| 358 |
</SelectList> |
| 359 |
); |
| 360 |
|
| 361 |
return ( |
| 362 |
<ToolbarFilter |
| 363 |
categoryName="Products" |
| 364 |
labels={filters.products} |
| 365 |
deleteLabel={(type, id) => onDelete(type as string, id as string)} |
| 366 |
> |
| 367 |
<Select |
| 368 |
aria-label="Products" |
| 369 |
role="menu" |
| 370 |
toggle={(toggleRef) => ( |
| 371 |
<MenuToggle ref={toggleRef} onClick={onToolbarDropdownToggle} isExpanded={isLowerToolbarDropdownOpen}> |
| 372 |
Filter by creator name |
| 373 |
{filters.products.length > 0 && <Badge isRead>{filters.products.length}</Badge>} |
| 374 |
</MenuToggle> |
| 375 |
)} |
| 376 |
onSelect={(event, selection) => onNameSelect(event, selection.toString())} |
| 377 |
onOpenChange={(isOpen) => { |
| 378 |
setIsLowerToolbarDropdownOpen(isOpen); |
| 379 |
}} |
| 380 |
selected={filters.products} |
| 381 |
isOpen={isLowerToolbarDropdownOpen} |
| 382 |
> |
| 383 |
{filterDropdownItems} |
| 384 |
</Select> |
| 385 |
</ToolbarFilter> |
| 386 |
); |
| 387 |
}; |
| 388 |
|
| 389 |
const toolbarKebabDropdownItems = [ |
| 390 |
<OverflowMenuDropdownItem itemId={0} key="link"> |
| 391 |
Link |
| 392 |
</OverflowMenuDropdownItem>, |
| 393 |
<OverflowMenuDropdownItem itemId={1} key="action" component="button"> |
| 394 |
Action |
| 395 |
</OverflowMenuDropdownItem>, |
| 396 |
<OverflowMenuDropdownItem itemId={2} key="disabled link" isDisabled> |
| 397 |
Disabled Link |
| 398 |
</OverflowMenuDropdownItem>, |
| 399 |
<OverflowMenuDropdownItem itemId={3} key="disabled action" isDisabled component="button"> |
| 400 |
Disabled Action |
| 401 |
</OverflowMenuDropdownItem>, |
| 402 |
<Divider key="separator" />, |
| 403 |
<OverflowMenuDropdownItem itemId={5} key="separated link"> |
| 404 |
Separated Link |
| 405 |
</OverflowMenuDropdownItem>, |
| 406 |
<OverflowMenuDropdownItem itemId={6} key="separated action" component="button"> |
| 407 |
Separated Action |
| 408 |
</OverflowMenuDropdownItem> |
| 409 |
]; |
| 410 |
|
| 411 |
const toolbarItems = ( |
| 412 |
<Fragment> |
| 413 |
<ToolbarItem>{buildSelectDropdown()}</ToolbarItem> |
| 414 |
<ToolbarItem>{buildFilterDropdown()}</ToolbarItem> |
| 415 |
<ToolbarItem> |
| 416 |
<OverflowMenu breakpoint="md"> |
| 417 |
<OverflowMenuItem> |
| 418 |
<Button variant="primary">Create a project</Button> |
| 419 |
</OverflowMenuItem> |
| 420 |
<OverflowMenuControl hasAdditionalOptions> |
| 421 |
<Dropdown |
| 422 |
onSelect={onToolbarKebabDropdownSelect} |
| 423 |
toggle={(toggleRef) => ( |
| 424 |
<MenuToggle |
| 425 |
ref={toggleRef} |
| 426 |
aria-label="Toolbar kebab overflow menu" |
| 427 |
variant="plain" |
| 428 |
onClick={onToolbarKebabDropdownToggle} |
| 429 |
isExpanded={isLowerToolbarKebabDropdownOpen} |
| 430 |
icon={<RhUiEllipsisVerticalFillIcon />} |
| 431 |
/> |
| 432 |
)} |
| 433 |
isOpen={isLowerToolbarKebabDropdownOpen} |
| 434 |
onOpenChange={(isOpen) => setIsLowerToolbarDropdownOpen(isOpen)} |
| 435 |
> |
| 436 |
<DropdownList>{toolbarKebabDropdownItems}</DropdownList> |
| 437 |
</Dropdown> |
| 438 |
</OverflowMenuControl> |
| 439 |
</OverflowMenu> |
| 440 |
</ToolbarItem> |
| 441 |
<ToolbarItem variant="pagination" align={{ default: 'alignEnd' }}> |
| 442 |
{renderPagination()} |
| 443 |
</ToolbarItem> |
| 444 |
</Fragment> |
| 445 |
); |
| 446 |
|
| 447 |
const icons = { |
| 448 |
pfIcon, |
| 449 |
activeMQIcon, |
| 450 |
sparkIcon, |
| 451 |
avroIcon, |
| 452 |
azureIcon, |
| 453 |
saxonIcon, |
| 454 |
dropBoxIcon, |
| 455 |
infinispanIcon, |
| 456 |
restIcon, |
| 457 |
swaggerIcon |
| 458 |
}; |
| 459 |
|
| 460 |
const filtered = |
| 461 |
filters.products.length > 0 |
| 462 |
? data.filter((card: { name: string }) => filters.products.length === 0 || filters.products.includes(card.name)) |
| 463 |
: cardData.slice((page - 1) * perPage, perPage === 1 ? page * perPage : page * perPage - 1); |
| 464 |
|
| 465 |
return ( |
| 466 |
<Fragment> |
| 467 |
<DashboardWrapper mainContainerId="main-content-card-view-default-nav" breadcrumb={null}> |
| 468 |
<PageSection aria-labelledby="projects"> |
| 469 |
<Content> |
| 470 |
<h1 id="projects">Projects</h1> |
| 471 |
<p>This is a demo that showcases PatternFly cards.</p> |
| 472 |
</Content> |
| 473 |
<Toolbar id="toolbar-group-types" clearAllFilters={onDelete}> |
| 474 |
<ToolbarContent>{toolbarItems}</ToolbarContent> |
| 475 |
</Toolbar> |
| 476 |
</PageSection> |
| 477 |
<PageSection isFilled aria-label="Selectable card gallery"> |
| 478 |
<Gallery hasGutter aria-label="Selectable card container"> |
| 479 |
<Card isCompact> |
| 480 |
<Bullseye> |
| 481 |
<EmptyState |
| 482 |
headingLevel="h2" |
| 483 |
titleText="Add a new card to your page" |
| 484 |
icon={RhUiAddCircleFillIcon} |
| 485 |
variant={EmptyStateVariant.xs} |
| 486 |
> |
| 487 |
<EmptyStateFooter> |
| 488 |
<EmptyStateActions> |
| 489 |
<Button variant="link">Add card</Button> |
| 490 |
</EmptyStateActions> |
| 491 |
</EmptyStateFooter> |
| 492 |
</EmptyState> |
| 493 |
</Bullseye> |
| 494 |
</Card> |
| 495 |
{filtered.map((product, key) => ( |
| 496 |
<Card isCompact isClickable isSelectable key={product.name} id={product.name.replace(/ /g, '-')}> |
| 497 |
<CardHeader |
| 498 |
selectableActions={{ |
| 499 |
isChecked: selectedItems.includes(product.id), |
| 500 |
selectableActionId: `selectable-actions-item-${product.id}`, |
| 501 |
selectableActionAriaLabelledby: product.name.replace(/ /g, '-'), |
| 502 |
name: `check-${product.id}`, |
| 503 |
onChange |
| 504 |
}} |
| 505 |
actions={{ |
| 506 |
actions: ( |
| 507 |
<> |
| 508 |
<Dropdown |
| 509 |
isOpen={!!state[key] ?? false} |
| 510 |
onOpenChange={(isOpen) => setState({ [key]: isOpen })} |
| 511 |
toggle={(toggleRef: React.Ref<MenuToggleElement>) => ( |
| 512 |
<MenuToggle |
| 513 |
ref={toggleRef} |
| 514 |
aria-label={`${product.name} actions`} |
| 515 |
variant="plain" |
| 516 |
onClick={(e) => { |
| 517 |
onCardKebabDropdownToggle(e, key.toString()); |
| 518 |
}} |
| 519 |
isExpanded={!!state[key]} |
| 520 |
icon={<RhUiEllipsisVerticalFillIcon />} |
| 521 |
/> |
| 522 |
)} |
| 523 |
popperProps={{ position: 'right' }} |
| 524 |
> |
| 525 |
<DropdownList> |
| 526 |
<DropdownItem |
| 527 |
key="trash" |
| 528 |
onClick={() => { |
| 529 |
deleteItem(product); |
| 530 |
}} |
| 531 |
> |
| 532 |
<TrashIcon /> |
| 533 |
Delete |
| 534 |
</DropdownItem> |
| 535 |
</DropdownList> |
| 536 |
</Dropdown> |
| 537 |
</> |
| 538 |
) |
| 539 |
}} |
| 540 |
> |
| 541 |
<img src={icons[product.icon]} alt={`${product.name} icon`} style={{ maxWidth: '60px' }} /> |
| 542 |
</CardHeader> |
| 543 |
<CardTitle>{product.name}</CardTitle> |
| 544 |
<CardBody>{product.description}</CardBody> |
| 545 |
</Card> |
| 546 |
))} |
| 547 |
</Gallery> |
| 548 |
</PageSection> |
| 549 |
<PageSection |
| 550 |
isFilled={false} |
| 551 |
stickyOnBreakpoint={{ default: 'bottom' }} |
| 552 |
padding={{ default: 'noPadding' }} |
| 553 |
aria-label="Pagination controls" |
| 554 |
> |
| 555 |
<Pagination |
| 556 |
itemCount={totalItemCount} |
| 557 |
page={page} |
| 558 |
perPage={perPage} |
| 559 |
onPerPageSelect={onPerPageSelect} |
| 560 |
onSetPage={onSetPage} |
| 561 |
variant="bottom" |
| 562 |
/> |
| 563 |
</PageSection> |
| 564 |
</DashboardWrapper> |
| 565 |
</Fragment> |
| 566 |
); |
| 567 |
}; |