import PropTypes from 'prop-types' import React from 'react' import { UncontrolledPopover, PopoverHeader, PopoverBody, Button } from 'reactstrap' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faTrash, faInfoCircle } from '@fortawesome/free-solid-svg-icons' import { ProcessingUnit, StorageUnit } from '../../../../../shapes' function UnitComponent({ index, unitType, unit, onDelete }) { let unitInfo if (unitType === 'cpu' || unitType === 'gpu') { unitInfo = ( <> Clockrate: {unit.clockRateMhz}
Num. Cores: {unit.numberOfCores}
Energy Cons.: {unit.energyConsumptionW} W
) } else if (unitType === 'memory' || unitType === 'storage') { unitInfo = ( <> Speed: {unit.speedMbPerS} Mb/s
Size: {unit.sizeMb} MB
Energy Cons.: {unit.energyConsumptionW} W
) } return (
  • {unit.name} Unit Information {unitInfo}
  • ) } UnitComponent.propTypes = { index: PropTypes.number, unitType: PropTypes.string, unit: PropTypes.oneOfType([ProcessingUnit, StorageUnit]), onDelete: PropTypes.func, } export default UnitComponent