]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20023 Add severity icons to new facet
authorstanislavh <stanislav.honcharov@sonarsource.com>
Mon, 21 Aug 2023 14:00:31 +0000 (16:00 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 21 Aug 2023 20:02:47 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/SimpleListStyleFacet.tsx

index 4d0329681a6b23b32148d7e01b41d5a1b3fd7b6a..cf878fcdb9f7c89600c9b7464ac0937c01e0fb7b 100644 (file)
@@ -20,6 +20,7 @@
 
 import * as React from 'react';
 import DocumentationTooltip from '../../../components/common/DocumentationTooltip';
+import SoftwareImpactSeverityIcon from '../../../components/icons/SoftwareImpactSeverityIcon';
 import { translate } from '../../../helpers/l10n';
 import { SoftwareImpactSeverity } from '../../../types/issues';
 import { CommonProps, SimpleListStyleFacet } from './SimpleListStyleFacet';
@@ -39,6 +40,7 @@ export function SeverityFacet(props: Props) {
       itemNamePrefix="severity"
       listItems={SEVERITIES}
       selectedItems={severities}
+      renderIcon={(severity: string) => <SoftwareImpactSeverityIcon severity={severity} />}
       help={
         <DocumentationTooltip
           placement="right"
index c52151e6722b1693d52c37443beef15405325450..a5e908258763d2347f0e08af2c2edf057030bc6b 100644 (file)
@@ -42,6 +42,7 @@ interface Props<T = string> extends CommonProps {
   listItems: Array<T>;
   itemNamePrefix: string;
   selectedItems: Array<T>;
+  renderIcon?: (item: string) => React.ReactNode;
 }
 
 export function SimpleListStyleFacet(props: Props) {
@@ -55,6 +56,7 @@ export function SimpleListStyleFacet(props: Props) {
     listItems,
     itemNamePrefix,
     help,
+    renderIcon,
   } = props;
 
   const nbSelectableItems = listItems.filter((item) => stats[item]).length;
@@ -86,6 +88,7 @@ export function SimpleListStyleFacet(props: Props) {
               active={active}
               className="it__search-navigator-facet"
               key={item}
+              icon={renderIcon?.(item)}
               name={translate(itemNamePrefix, item)}
               onClick={(itemValue, multiple) => {
                 if (multiple) {