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.
39 lines
793 B
39 lines
793 B
7 years ago
|
import _ from 'lodash';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import React from 'react';
|
||
|
import { kinds } from 'Helpers/Props';
|
||
|
import Label from './Label';
|
||
|
import styles from './TagList.css';
|
||
|
|
||
|
function TagList({ tags, tagList }) {
|
||
|
return (
|
||
|
<div className={styles.tags}>
|
||
|
{
|
||
|
tags.map((t) => {
|
||
|
const tag = _.find(tagList, { id: t });
|
||
|
|
||
|
if (!tag) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<Label
|
||
|
key={tag.id}
|
||
|
kind={kinds.INFO}
|
||
|
>
|
||
|
{tag.label}
|
||
|
</Label>
|
||
|
);
|
||
|
})
|
||
|
}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
TagList.propTypes = {
|
||
|
tags: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||
|
tagList: PropTypes.arrayOf(PropTypes.object).isRequired
|
||
|
};
|
||
|
|
||
|
export default TagList;
|