+++ /dev/null
-/*
- * 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 * as React from 'react';
-import tw from 'twin.macro';
-import { themeBorder, themeColor } from '../helpers/theme';
-import { BasicSeparator } from './Separator';
-
-interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
- children: React.ReactNode;
-}
-
-export function Card(props: Readonly<CardProps>) {
- const { children, ...rest } = props;
-
- return <CardStyled {...rest}>{children}</CardStyled>;
-}
-
-export function GreyCard(props: Readonly<CardProps>) {
- const { children, ...rest } = props;
-
- return <GreyCardStyled {...rest}>{children}</GreyCardStyled>;
-}
-
-export function LightGreyCard(props: Readonly<CardProps>) {
- const { children, ...rest } = props;
-
- return <LightGreyCardStyled {...rest}>{children}</LightGreyCardStyled>;
-}
-
-export function LightGreyCardTitle({ children }: Readonly<React.PropsWithChildren>) {
- return (
- <>
- <div className="sw-flex sw-items-center sw-justify-between sw-w-full sw-mb-4 sw-min-h-6">
- {children}
- </div>
- <BasicSeparator className="sw--mx-6 sw-my-0" />
- </>
- );
-}
-
-export const CardWithPrimaryBackground = styled(Card)`
- background-color: ${themeColor('backgroundPrimary')};
-`;
-
-const CardStyled = styled.div`
- background-color: ${themeColor('backgroundSecondary')};
- border: ${themeBorder('default', 'projectCardBorder')};
-
- ${tw`sw-p-6`};
- ${tw`sw-rounded-1`};
-`;
-
-const LightGreyCardStyled = styled(CardStyled)`
- border: ${themeBorder('default')};
-`;
-
-const GreyCardStyled = styled(CardStyled)`
- border: ${themeBorder('default', 'almCardBorder')};
-`;
+++ /dev/null
-/*
- * 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 tw from 'twin.macro';
-import { getProp, themeColor, themeContrast } from '../helpers/theme';
-import { MetricsLabel } from '../types/measures';
-
-type sizeType = keyof typeof SIZE_MAPPING;
-interface Props extends React.AriaAttributes {
- className?: string;
- label: string;
- rating?: MetricsLabel;
- size?: sizeType;
-}
-
-const SIZE_MAPPING = {
- xs: '1rem',
- sm: '1.5rem',
- md: '2rem',
- lg: '2.8rem',
- xl: '4rem',
-};
-
-export function MetricsRatingBadge({
- className,
- size = 'sm',
- label,
- rating,
- ...ariaAttrs
-}: Readonly<Props>) {
- if (!rating) {
- return (
- <StyledNoRatingBadge
- aria-label={label}
- className={className}
- size={SIZE_MAPPING[size]}
- {...ariaAttrs}
- >
- —
- </StyledNoRatingBadge>
- );
- }
- return (
- <MetricsRatingBadgeStyled
- aria-label={label}
- className={className}
- rating={rating}
- size={SIZE_MAPPING[size]}
- {...ariaAttrs}
- >
- {rating}
- </MetricsRatingBadgeStyled>
- );
-}
-
-const StyledNoRatingBadge = styled.div<{ size: string }>`
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: ${getProp('size')};
- height: ${getProp('size')};
-`;
-
-const getFontSize = (size: string) => {
- switch (size) {
- case '2rem':
- return '0.875rem';
- case '4rem':
- return '1.5rem';
- default:
- return '0.75rem';
- }
-};
-
-const MetricsRatingBadgeStyled = styled.div<{ rating: MetricsLabel; size: string }>`
- width: ${getProp('size')};
- height: ${getProp('size')};
- color: ${({ rating }) => themeContrast(`rating.${rating}`)};
- font-size: ${({ size }) => getFontSize(size)};
- background-color: ${({ rating }) => themeColor(`rating.${rating}`)};
- user-select: none;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- ${tw`sw-rounded-pill`};
- ${tw`sw-font-semibold`};
-`;
+++ /dev/null
-/*
- * 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 { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { Card, GreyCard, LightGreyCard } from '../Card';
-
-it('renders card correctly', () => {
- render(<Card>Hello</Card>);
- const cardContent = screen.getByText('Hello');
- expect(cardContent).toHaveStyle({
- border: '1px solid rgb(225,230,243)',
- 'background-color': 'rgb(255,255,255)',
- });
-});
-
-it.each([Card, GreyCard, LightGreyCard])(
- 'renders %p correctly with classNames',
- (CardComponent) => {
- render(
- <CardComponent className="sw-bg-black sw-border-8" role="tabpanel">
- Hello
- </CardComponent>,
- );
- const cardContent = screen.getByText('Hello');
- expect(cardContent).toHaveClass('sw-bg-black sw-border-8');
- expect(cardContent).toHaveAttribute('role', 'tabpanel');
- },
-);
+++ /dev/null
-/*
- * 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 { screen } from '@testing-library/react';
-import { render } from '../../helpers/testUtils';
-import { FCProps } from '../../types/misc';
-
-import { MetricsRatingBadge } from '../MetricsRatingBadge';
-
-it('should display RatingIndicator', () => {
- setupWithProps();
- expect(screen.getByLabelText('New label')).toBeInTheDocument();
-});
-
-it('should display RatingIndicator with value', () => {
- setupWithProps({ rating: 'A' });
- expect(screen.getByText('A')).toBeInTheDocument();
-});
-
-function setupWithProps(props: Partial<FCProps<typeof MetricsRatingBadge>> = {}) {
- return render(<MetricsRatingBadge label="New label" {...props} />);
-}
export * from './BorderlessAccordion';
export { Breadcrumbs } from './Breadcrumbs';
export * from './BubbleChart';
-export * from './Card';
export * from './CodeSnippet';
export * from './CodeSyntaxHighlighter';
export * from './ColorsLegend';
export * from './MainAppBar';
export * from './MainMenu';
export * from './MainMenuItem';
-export * from './MetricsRatingBadge';
export * from './MultiSelector';
export * from './NavBarTabs';
export * from './NewCodeLegend';
*/
export * from './components';
export * from './helpers';
+export * from './sonar-aligned';
export * from './theme';
export * from './types';
--- /dev/null
+/*
+ * 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 * as React from 'react';
+import tw from 'twin.macro';
+import { BasicSeparator } from '../../components/Separator';
+import { themeBorder, themeColor } from '../../helpers/theme';
+
+interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
+ children: React.ReactNode;
+}
+
+export function Card(props: Readonly<CardProps>) {
+ const { children, ...rest } = props;
+
+ return <CardStyled {...rest}>{children}</CardStyled>;
+}
+
+export function GreyCard(props: Readonly<CardProps>) {
+ const { children, ...rest } = props;
+
+ return <GreyCardStyled {...rest}>{children}</GreyCardStyled>;
+}
+
+export function LightGreyCard(props: Readonly<CardProps>) {
+ const { children, ...rest } = props;
+
+ return <LightGreyCardStyled {...rest}>{children}</LightGreyCardStyled>;
+}
+
+export function LightGreyCardTitle({ children }: Readonly<React.PropsWithChildren>) {
+ return (
+ <>
+ <div className="sw-flex sw-items-center sw-justify-between sw-w-full sw-mb-4 sw-min-h-6">
+ {children}
+ </div>
+ <BasicSeparator className="sw--mx-6 sw-my-0" />
+ </>
+ );
+}
+
+export const CardWithPrimaryBackground = styled(Card)`
+ background-color: ${themeColor('backgroundPrimary')};
+`;
+
+const CardStyled = styled.div`
+ background-color: ${themeColor('backgroundSecondary')};
+ border: ${themeBorder('default', 'projectCardBorder')};
+
+ ${tw`sw-p-6`};
+ ${tw`sw-rounded-1`};
+`;
+
+const LightGreyCardStyled = styled(CardStyled)`
+ border: ${themeBorder('default')};
+`;
+
+const GreyCardStyled = styled(CardStyled)`
+ border: ${themeBorder('default', 'almCardBorder')};
+`;
--- /dev/null
+/*
+ * 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 tw from 'twin.macro';
+import { getProp, themeColor, themeContrast } from '../../helpers/theme';
+import { RatingLabel } from '../types/measures';
+
+type sizeType = keyof typeof SIZE_MAPPING;
+interface Props extends React.AriaAttributes {
+ className?: string;
+ label?: string;
+ rating?: RatingLabel;
+ size?: sizeType;
+}
+
+const SIZE_MAPPING = {
+ xs: '1rem',
+ sm: '1.5rem',
+ md: '2rem',
+ lg: '2.8rem',
+ xl: '4rem',
+};
+
+export function MetricsRatingBadge({
+ className,
+ size = 'sm',
+ label,
+ rating,
+ ...ariaAttrs
+}: Readonly<Props>) {
+ if (!rating) {
+ return (
+ <StyledNoRatingBadge
+ aria-label={label}
+ className={className}
+ size={SIZE_MAPPING[size]}
+ {...ariaAttrs}
+ >
+ —
+ </StyledNoRatingBadge>
+ );
+ }
+ return (
+ <MetricsRatingBadgeStyled
+ aria-label={label}
+ className={className}
+ rating={rating}
+ size={SIZE_MAPPING[size]}
+ {...ariaAttrs}
+ >
+ {rating}
+ </MetricsRatingBadgeStyled>
+ );
+}
+
+const StyledNoRatingBadge = styled.div<{ size: string }>`
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+
+ width: ${getProp('size')};
+ height: ${getProp('size')};
+`;
+
+const getFontSize = (size: string) => {
+ switch (size) {
+ case '2rem':
+ return '0.875rem';
+ case '4rem':
+ return '1.5rem';
+ default:
+ return '0.75rem';
+ }
+};
+
+const MetricsRatingBadgeStyled = styled.div<{ rating: RatingLabel; size: string }>`
+ width: ${getProp('size')};
+ height: ${getProp('size')};
+ color: ${({ rating }) => themeContrast(`rating.${rating}`)};
+ font-size: ${({ size }) => getFontSize(size)};
+ background-color: ${({ rating }) => themeColor(`rating.${rating}`)};
+ user-select: none;
+
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+
+ ${tw`sw-rounded-pill`};
+ ${tw`sw-font-semibold`};
+`;
--- /dev/null
+/*
+ * 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 { screen } from '@testing-library/react';
+import { render } from '../../../helpers/testUtils';
+import { Card, GreyCard, LightGreyCard } from '../Card';
+
+it('renders card correctly', () => {
+ render(<Card>Hello</Card>);
+ const cardContent = screen.getByText('Hello');
+ expect(cardContent).toHaveStyle({
+ border: '1px solid rgb(225,230,243)',
+ 'background-color': 'rgb(255,255,255)',
+ });
+});
+
+it.each([Card, GreyCard, LightGreyCard])(
+ 'renders %p correctly with classNames',
+ (CardComponent) => {
+ render(
+ <CardComponent className="sw-bg-black sw-border-8" role="tabpanel">
+ Hello
+ </CardComponent>,
+ );
+ const cardContent = screen.getByText('Hello');
+ expect(cardContent).toHaveClass('sw-bg-black sw-border-8');
+ expect(cardContent).toHaveAttribute('role', 'tabpanel');
+ },
+);
--- /dev/null
+/*
+ * 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 { screen } from '@testing-library/react';
+import { render } from '../../../helpers/testUtils';
+import { FCProps } from '../../../types/misc';
+
+import { MetricsRatingBadge } from '../MetricsRatingBadge';
+
+it('should display RatingIndicator', () => {
+ setupWithProps();
+ expect(screen.getByLabelText('New label')).toBeInTheDocument();
+});
+
+it('should display RatingIndicator with value', () => {
+ setupWithProps({ rating: 'A' });
+ expect(screen.getByText('A')).toBeInTheDocument();
+});
+
+function setupWithProps(props: Partial<FCProps<typeof MetricsRatingBadge>> = {}) {
+ return render(<MetricsRatingBadge label="New label" {...props} />);
+}
--- /dev/null
+/*
+ * 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.
+ */
+
+export * from './Card';
+export * from './MetricsRatingBadge';
--- /dev/null
+/*
+ * 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.
+ */
+
+export * from './components';
+export * from './types';
--- /dev/null
+/*
+ * 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.
+ */
+
+export * from './measures';
--- /dev/null
+/*
+ * 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.
+ */
+
+export enum RatingEnum {
+ A = 'A',
+ B = 'B',
+ C = 'C',
+ D = 'D',
+ E = 'E',
+}
+
+export type RatingLabel = keyof typeof RatingEnum;
export type DuplicationLabel = keyof typeof DuplicationEnum;
-export enum MetricsEnum {
- A = 'A',
- B = 'B',
- C = 'C',
- D = 'D',
- E = 'E',
-}
-
-export type MetricsLabel = keyof typeof MetricsEnum;
-
export enum SizeEnum {
XS = 'XS',
S = 'S',
"~helpers/*": ["src/helpers/*"],
"~icons/*": ["src/icons/*"],
"~types/*": ["src/types/*"],
- "~utils/*": ["src/utils/*"]
+ "~utils/*": ["src/utils/*"],
+ "~sonar-aligned/*": ["src/sonar-aligned/*"]
},
"resolveJsonModule": true,
"skipLibCheck": true
*/
import {
ContentCell,
- MetricsEnum,
MetricsRatingBadge,
NumericalCell,
QualityGateIndicator,
RatingCell,
+ RatingEnum,
} from 'design-system';
import * as React from 'react';
import Measure from '../../../components/measure/Measure';
<RatingCell className="sw-whitespace-nowrap">
<MetricsRatingBadge
label={value ?? '—'}
- rating={formatMeasure(value, MetricType.Rating) as MetricsEnum}
+ rating={formatMeasure(value, MetricType.Rating) as RatingEnum}
/>
</RatingCell>
);
*/
import { LinkStandalone } from '@sonarsource/echoes-react';
import classNames from 'classnames';
-import { MetricsLabel, MetricsRatingBadge } from 'design-system';
+import { MetricsRatingBadge, RatingLabel } from 'design-system';
import * as React from 'react';
import LanguageDistribution from '../../../components/charts/LanguageDistribution';
import Tooltip from '../../../components/controls/Tooltip';
)
: translate('metric.no_rating')
}
- rating={formatMeasure(measureValue, MetricType.Rating) as MetricsLabel}
+ rating={formatMeasure(measureValue, MetricType.Rating) as RatingLabel}
/>
}
/>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsLabel, MetricsRatingBadge, NumericalCell } from 'design-system';
+import { MetricsRatingBadge, NumericalCell, RatingLabel } from 'design-system';
import * as React from 'react';
import Measure from '../../../components/measure/Measure';
import { translate, translateWithParameters } from '../../../helpers/l10n';
)
: translate('metric.no_rating')
}
- rating={formatMeasure(value, MetricType.Rating) as MetricsLabel}
+ rating={formatMeasure(value, MetricType.Rating) as RatingLabel}
/>
}
/>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsLabel, MetricsRatingBadge, Note } from 'design-system';
+import { MetricsRatingBadge, Note, RatingLabel } from 'design-system';
import React from 'react';
import Measure from '../../../components/measure/Measure';
import { translate, translateWithParameters } from '../../../helpers/l10n';
? translateWithParameters('metric.has_rating_X', formatted)
: translate('metric.no_rating')
}
- rating={formatted as MetricsLabel}
+ rating={formatted as RatingLabel}
/>
}
metricKey={measure.metric.key}
import {
CoverageIndicator,
DuplicationsIndicator,
- MetricsLabel,
MetricsRatingBadge,
Note,
PageContentFontWrapper,
+ RatingLabel,
} from 'design-system';
import * as React from 'react';
import Measure from '../../../../components/measure/Measure';
return (
<ProjectCardMeasure key={metricKey} metricKey={metricKey} label={iconLabel}>
- <MetricsRatingBadge label={metricKey} rating={value as MetricsLabel} />
+ <MetricsRatingBadge label={metricKey} rating={value as RatingLabel} />
<Measure
metricKey={metricKey}
metricType={metricType}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsEnum, MetricsRatingBadge } from 'design-system';
+import { MetricsRatingBadge, RatingEnum } from 'design-system';
import * as React from 'react';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { formatMeasure } from '../../../helpers/measures';
const ratingFormatted = formatMeasure(option, MetricType.Rating);
return (
- <MetricsRatingBadge label={ratingFormatted} rating={ratingFormatted as MetricsEnum} size="xs" />
+ <MetricsRatingBadge label={ratingFormatted} rating={ratingFormatted as RatingEnum} size="xs" />
);
}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsEnum, MetricsRatingBadge } from 'design-system';
+import { MetricsRatingBadge, RatingEnum } from 'design-system';
import * as React from 'react';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { formatMeasure } from '../../../helpers/measures';
<div className="sw-flex sw-items-center">
<MetricsRatingBadge
label={ratingFormatted}
- rating={ratingFormatted as MetricsEnum}
+ rating={ratingFormatted as RatingEnum}
size="xs"
/>
<span className="sw-ml-2">{labels[option]}</span>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { MetricsLabel, MetricsRatingBadge, QualityGateIndicator } from 'design-system';
+import { MetricsRatingBadge, QualityGateIndicator, RatingLabel } from 'design-system';
import * as React from 'react';
import Tooltip from '../../components/controls/Tooltip';
import { translate, translateWithParameters } from '../../helpers/l10n';
? translateWithParameters('metric.has_rating_X', formatMeasure(value, MetricType.Rating))
: translate('metric.no_rating')
}
- rating={formatMeasure(value, MetricType.Rating) as MetricsLabel}
+ rating={formatMeasure(value, MetricType.Rating) as RatingLabel}
/>
);
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { CoverageIndicator, DuplicationsIndicator, MetricsRatingBadge } from 'design-system';
+import {
+ CoverageIndicator,
+ DuplicationsIndicator,
+ MetricsRatingBadge,
+ RatingEnum,
+} from 'design-system';
import * as React from 'react';
import { formatMeasure } from '../../helpers/measures';
import { MetricKey, MetricType } from '../../types/metrics';
value: string | undefined;
}
-enum MetricsEnum {
- A = 'A',
- B = 'B',
- C = 'C',
- D = 'D',
- E = 'E',
-}
-
export default function MeasureIndicator(props: Props) {
const { className, metricKey, metricType, value } = props;
const ratingFormatted = formatMeasure(value, MetricType.Rating);
const ratingComponent = (
- <MetricsRatingBadge rating={ratingFormatted as MetricsEnum} label={ratingFormatted} />
+ <MetricsRatingBadge rating={ratingFormatted as RatingEnum} label={ratingFormatted} />
);
return <Measure {...props} ratingComponent={ratingComponent} />;