1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-18 01:18:23 +02:00
unleash.unleash/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/VariantsTooltip.tsx
Thomas Heartman fe09ae214f
chore: fix "key" prop issues in front end tests (#8459)
Fixes all warnings about the "key" prop. The majority of the fixes fall
into one of the following categories:

- Extracting "key" props in tables (you're not allowed to just spread
them in)
- Adding "key" props to autocomplete options and chips
- fixing test data that didn't contain ids
2024-10-16 14:57:43 +02:00

26 lines
690 B
TypeScript

import { TooltipLink } from 'component/common/TooltipLink/TooltipLink';
import type { FC } from 'react';
export const VariantsTooltip: FC<{
variants: string[];
}> = ({ variants }) => {
if (variants.length === 1 && variants[0].length < 20) {
return <span>{variants[0]}</span>;
}
return (
<TooltipLink
tooltip={
<>
{variants.map((child, i) => (
<div key={i}>{child}</div>
))}
</>
}
>
{variants.length === 1
? '1 variant'
: `${variants.length} variants`}
</TooltipLink>
);
};