return (
<div className="display-flex-center">
{option < NO_DATA_OPTION && (
- <CoverageRating
- muted={!selected}
- size="small"
- value={getCoverageRatingAverageValue(option)}
- />
+ <CoverageRating muted={!selected} value={getCoverageRatingAverageValue(option)} />
)}
<span className="spacer-left">
{option < NO_DATA_OPTION ? (
function renderOption(option: number, selected: boolean) {
return (
<span>
- <Rating muted={!selected} small={true} value={option} />
+ <Rating muted={!selected} value={option} />
<span className="spacer-left">
{translateWithParameters('projects.facets.rating_x', formatMeasure(option, 'RATING'))}
</span>
function renderOption(option: number, selected: boolean) {
return (
<span>
- <Rating muted={!selected} small={true} value={option} />
+ <Rating muted={!selected} value={option} />
<span className="spacer-left">{labels[option]}</span>
</span>
);
function renderOption(option: number, selected: boolean) {
return (
<div className="display-flex-center">
- <SizeRating muted={!selected} small={true} value={getSizeRatingAverageValue(option)} />
+ <SizeRating muted={!selected} value={getSizeRatingAverageValue(option)} />
<span className="spacer-left">{getSizeRatingLabel(option)}</span>
</div>
);
>
<CoverageRating
muted={true}
- size="small"
value={75}
/>
<span
<span>
<Rating
muted={true}
- small={true}
value={2}
/>
<span
<span>
<Rating
muted={true}
- small={true}
value={2}
/>
<span
>
<SizeRating
muted={true}
- small={true}
value={5000}
/>
<span
</td>
<td className="text-right spacer-right">
<span className="activity-graph-tooltip-value">{value}</span>
- {ratingValue && <Rating className="spacer-left" small={true} value={ratingValue} />}
+ {ratingValue && <Rating className="spacer-left" value={ratingValue} />}
</td>
<td>{translatedName}</td>
</tr>
}
const tooltip = <RatingTooltipContent metricKey={metricKey} value={value} />;
- const rating = <Rating small={small} value={value} />;
+ const rating = <Rating value={value} />;
if (tooltip) {
return (
justify-content: space-between;
align-items: center;
width: 100%;
- height: var(--controlHeight);
- margin: 0 0 1px 0;
+ height: calc(3.5 * var(--gridSize));
+ margin-bottom: 1px;
padding: 0 calc(0.75 * var(--gridSize));
border: 1px solid transparent;
border-radius: 2px;
}
.duplications-rating-small {
- width: 20px;
- height: 20px;
+ width: 24px;
+ height: 24px;
border-width: 3px;
}
justify-content: center;
}
-.rating-small {
- width: 20px;
- height: 20px;
- margin-top: -1px;
- margin-bottom: -1px;
- font-size: var(--mediumFontSize);
-}
-
.rating-muted {
background-color: var(--gray71) !important;
color: var(--white) !important;
value: string | number | undefined;
}
-export default function Rating({
- className,
- muted = false,
- small = false,
- value,
- ...ariaAttrs
-}: Props) {
+export default function Rating({ className, muted = false, value, ...ariaAttrs }: Props) {
if (value === undefined) {
return (
<span
- className={classNames(
- 'no-rating',
- { 'rating-small': small, 'rating-muted': muted },
- className
- )}
+ className={classNames('no-rating', { 'rating-muted': muted }, className)}
aria-label={translate('metric.no_rating')}
{...ariaAttrs}
>
return (
<span
aria-label={translateWithParameters('metric.has_rating_X', formatted)}
- className={classNames(
- 'rating',
- `rating-${formatted}`,
- { 'rating-small': small, 'rating-muted': muted },
- className
- )}
+ className={classNames('rating', `rating-${formatted}`, { 'rating-muted': muted }, className)}
{...ariaAttrs}
>
{formatted}
text-align: center;
}
-.size-rating-small {
- width: 20px;
- height: 20px;
- line-height: 20px;
- margin-top: -1px;
- margin-bottom: -1px;
-}
-
.size-rating-muted {
background-color: var(--gray71);
}
export interface Props {
muted?: boolean;
- small?: boolean;
value: number | null | undefined;
}
-export default function SizeRating({ small = false, muted = false, value }: Props) {
+export default function SizeRating({ muted = false, value }: Props) {
if (value == null) {
return <div className="size-rating size-rating-muted"> </div>;
}
}
const className = classNames('size-rating', {
- 'size-rating-small': small,
'size-rating-muted': muted,
});
});
it('renders string value', () => {
- expect(shallow(<Rating value="2.0" muted={true} small={true} />)).toMatchSnapshot();
+ expect(shallow(<Rating value="2.0" muted={true} />)).toMatchSnapshot();
});
it('renders undefined value', () => {
- expect(shallow(<Rating value={undefined} muted={true} small={true} />)).toMatchSnapshot();
+ expect(shallow(<Rating value={undefined} muted={true} />)).toMatchSnapshot();
});
it('renders with a custom aria-label', () => {
it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
- expect(shallowRender({ muted: true, small: true, value: 1000 })).toMatchSnapshot();
+ expect(shallowRender({ muted: true, value: 1000 })).toMatchSnapshot();
expect(shallowRender({ value: 10000 })).toMatchSnapshot();
expect(shallowRender({ value: 100000 })).toMatchSnapshot();
expect(shallowRender({ value: 500000 })).toMatchSnapshot();
exports[`renders string value 1`] = `
<span
aria-label="metric.has_rating_X.B"
- className="rating rating-B rating-small rating-muted"
+ className="rating rating-B rating-muted"
>
B
</span>
exports[`renders undefined value 1`] = `
<span
aria-label="metric.no_rating"
- className="no-rating rating-small rating-muted"
+ className="no-rating rating-muted"
>
–
</span>
exports[`should render correctly 2`] = `
<div
aria-hidden="true"
- className="size-rating size-rating-small size-rating-muted"
+ className="size-rating size-rating-muted"
>
S
</div>