-
{
+ wonPercentage < 5 ? setShowTooltip(true) : setShowTooltip(false);
+ }}
+ onHoverEnd={() => setShowTooltip(false)}
style={{
width: `${wonPercentage}%`,
+ borderRadius:
+ wonPercentage >= 100 ? '0.75rem' : '0.75rem 0 0 0.75rem',
backgroundColor: 'hsla(var(--green-400))',
}}
>
- {wonPercentage}
- {matchesData.matchesWon} won
-
-
+ {showTooltip && wonPercentage < 5 && (
+
+
+ {wonPercentage}% won
+
+
+ Matches {won}
+
+
+ )}
+
+ {wonPercentage >= 5 && (
+ <>
+
{wonPercentage}
+
{won} won
+ >
+ )}
+
+
{
+ lostPercentage < 5 ? setShowTooltip(true) : setShowTooltip(false);
+ }}
+ onHoverEnd={() => setShowTooltip(false)}
style={{
width: `${lostPercentage}%`,
+ borderRadius:
+ lostPercentage >= 100 ? '0.75rem' : '0 0.75rem 0.75rem 0',
backgroundColor: 'hsla(var(--red-400))',
}}
>
- {lostPercentage}
- {matchesData.matchesLost} lost
-
+
+ {showTooltip && lostPercentage < 5 && (
+
+
+ {lostPercentage}% lost
+
+
+ Matches {lost}
+
+
+ )}
+
+ {lostPercentage >= 5 && (
+ <>
+
{lostPercentage}
+
{lost} lost
+ >
+ )}
+