]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-23138 Fix counter contrast
authorJeremy Davis <jeremy.davis@sonarsource.com>
Tue, 8 Oct 2024 15:25:44 +0000 (17:25 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 9 Oct 2024 20:02:45 +0000 (20:02 +0000)
server/sonar-web/design-system/src/components/Badge.tsx

index 1746a417d0c4d9f938e0183ed2607a414cd59414..a88c457b4e69c14cd70fba883e4a645c029562ab 100644 (file)
@@ -38,6 +38,14 @@ interface BadgeProps extends React.PropsWithChildren {
   variant?: BadgeVariant;
 }
 
+function getColor(variantInfo: ThemeColors) {
+  if (variantInfo === 'badgeCounterFailed') {
+    return 'var(--echoes-color-text-danger-bold)';
+  }
+
+  return themeContrast(variantInfo);
+}
+
 export function Badge({ className, children, title, variant = 'default' }: BadgeProps) {
   const commonProps = {
     'aria-label': title,
@@ -87,7 +95,7 @@ const StyledCounter = styled.span<{
   ${tw`sw-items-center sw-justify-center`};
   ${tw`sw-rounded-pill`};
 
-  color: ${({ variantInfo }) => themeContrast(variantInfo)};
+  color: ${({ variantInfo }) => getColor(variantInfo)};
   background-color: ${({ variantInfo }) => themeColor(variantInfo)};
   border: ${({ variantInfo }) =>
     themeBorder(