import PropTypes from 'prop-types' import React from 'react' import MachineComponent from './MachineComponent' import { Badge, Button, DataList, DataListAction, DataListCell, DataListItem, DataListItemCells, DataListItemRow, } from '@patternfly/react-core' import { AngleRightIcon, PlusIcon } from '@patternfly/react-icons' import { Machine } from '../../../../shapes' function MachineListComponent({ machines = [], onSelect, onAdd }) { return ( {machines .map((machine, index) => machine ? ( onSelect(index + 1)}> {index + 1}U , onSelect(index + 1)} machine={machine} /> , ]} /> ) : ( {index + 1}U , Empty Slot , ]} /> ) ) .reverse()} ) } MachineListComponent.propTypes = { machines: PropTypes.arrayOf(Machine), onSelect: PropTypes.func.isRequired, onAdd: PropTypes.func.isRequired, } export default MachineListComponent