/* * SonarQube * Copyright (C) 2009-2024 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import styled from '@emotion/styled'; import { LinkHighlight, LinkStandalone } from '@sonarsource/echoes-react'; import { Badge, Card, themeBorder, themeColor } from 'design-system'; import * as React from 'react'; import { To } from 'react-router-dom'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { localizeMetric } from '../../../helpers/measures'; import { MetricKey } from '../../../types/metrics'; export interface MeasuresCardProps { url: To; value?: string; metric: MetricKey; label: string; failed?: boolean; icon?: React.ReactElement; } export default function MeasuresCard( props: React.PropsWithChildren>, ) { const { failed, children, metric, icon, value, url, label, ...rest } = props; return ( {translate(label)} {failed && ( {translate('overview.measures.failed_badge')} )}
{value ?? '-'} {icon}
{children &&
{children}
}
); } const StyledCard = styled(Card)` border: ${themeBorder('default')}; `; const ColorBold = styled.span` color: ${themeColor('pageTitle')}; `;