import PropTypes from 'prop-types'; import React from 'react'; import Label from 'Components/Label'; import Tooltip from 'Components/Tooltip/Tooltip'; import { kinds, tooltipPositions } from 'Helpers/Props'; function CategoryLabel({ categories }) { const sortedCategories = categories.filter((cat) => cat.name !== undefined).sort((c) => c.id); if (categories?.length === 0) { return ( Unknown} tooltip="Please report this issue to the GitHub as this shouldn't be happening" position={tooltipPositions.LEFT} /> ); } return ( { sortedCategories.map((category) => { return ( ); }) } ); } CategoryLabel.defaultProps = { categories: [] }; CategoryLabel.propTypes = { categories: PropTypes.arrayOf(PropTypes.object).isRequired }; export default CategoryLabel;