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.
Prowlarr/frontend/src/Components/TagList.js

37 lines
843 B

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 }) {
const sortedTags = tags
.map((tagId) => tagList.find((tag) => tag.id === tagId))
.filter((t) => t !== undefined)
.sort((a, b) => a.label.localeCompare(b.label));
return (
<div className={styles.tags}>
{
sortedTags.map((tag) => {
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;