/* eslint-disable react/no-array-index-key */ import React from 'react'; import { PropTypes } from 'prop-types'; import useSettingsContext from '../../contexts/settings'; import './CategoryPill.css'; // eslint-disable-next-line import/prefer-default-export, arrow-body-style export const CategoryPills = (props) => { const { categories } = props; const { settings } = useSettingsContext(); const regex = settings.CategoryAlertRegex ?? '.*'; if (categories) { let alerts = []; const normal = []; // eslint-disable-next-line array-callback-return categories.map((category, index) => { if (category.match(regex)) { alerts.push( {category} , ); } else { normal.push( {category} , ); } }); alerts = alerts.concat(normal); return