mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-18 01:18:23 +02:00
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
26 lines
690 B
TypeScript
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>
|
|
);
|
|
};
|