You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
595 B
28 lines
595 B
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import Label from 'Components/Label';
|
|
|
|
function CategoryLabel({ categories = [] }) {
|
|
const sortedCategories = categories.filter((cat) => cat.name !== undefined).sort((c) => c.id);
|
|
|
|
return (
|
|
<span>
|
|
{
|
|
sortedCategories.map((category) => {
|
|
return (
|
|
<Label key={category.name}>
|
|
{category.name}
|
|
</Label>
|
|
);
|
|
})
|
|
}
|
|
</span>
|
|
);
|
|
}
|
|
|
|
CategoryLabel.propTypes = {
|
|
categories: PropTypes.arrayOf(PropTypes.object)
|
|
};
|
|
|
|
export default CategoryLabel;
|