Skip to content

Commit 27b3c06

Browse files
Refactor tooltip component
The AI will refactor the tooltip component to ensure consistent styling and prevent further issues with text color and structure. This involves a strategic change in approach to address the persistent inconsistencies.
1 parent 0aaa2e8 commit 27b3c06

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

src/components/CampaignInfoCards.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TrendingUp, Calendar, ExternalLink, Copy } from 'lucide-react';
66
import { Campaign } from '@/types';
77
import { useToast } from '@/hooks/use-toast';
88
import { IntegrationStatusIndicator } from './IntegrationStatusIndicator';
9-
import { InfoTooltip } from './InfoTooltip';
9+
import { CustomInfoTooltip } from './CustomInfoTooltip';
1010

1111
interface CampaignInfoCardsProps {
1212
campaign: Campaign;
@@ -83,7 +83,7 @@ export const CampaignInfoCards = ({ campaign }: CampaignInfoCardsProps) => {
8383
<div className="flex items-center gap-2 text-blue-600 mb-2">
8484
<ExternalLink className="h-4 w-4" />
8585
<span className="text-sm font-medium">Dashboard public</span>
86-
<InfoTooltip text="Partagez ce lien avec vos affiliés pour qu'ils puissent consulter leurs statistiques et accéder à leurs liens de tracking." />
86+
<CustomInfoTooltip text="Partagez ce lien avec vos affiliés pour qu'ils puissent consulter leurs statistiques et accéder à leurs liens de tracking." />
8787
</div>
8888
<div className="space-y-2">
8989
<div className="flex items-center gap-2">
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { useState } from 'react';
2+
import { HelpCircle } from 'lucide-react';
3+
4+
interface CustomInfoTooltipProps {
5+
text: string;
6+
}
7+
8+
export const CustomInfoTooltip = ({ text }: CustomInfoTooltipProps) => {
9+
const [isVisible, setIsVisible] = useState(false);
10+
11+
return (
12+
<div className="relative inline-block">
13+
<HelpCircle
14+
className="h-3 w-3 text-blue-500/70 cursor-help"
15+
onMouseEnter={() => setIsVisible(true)}
16+
onMouseLeave={() => setIsVisible(false)}
17+
/>
18+
{isVisible && (
19+
<div className="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-1.5 bg-gray-900 text-white text-xs rounded-md shadow-lg z-50 whitespace-nowrap max-w-xs">
20+
{text}
21+
<div className="absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-900"></div>
22+
</div>
23+
)}
24+
</div>
25+
);
26+
};

src/components/IntegrationStatusIndicator.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Badge } from '@/components/ui/badge';
44
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
55
import { CheckCircle, AlertCircle, XCircle, RefreshCw } from 'lucide-react';
66
import { Campaign } from '@/types';
7-
import { InfoTooltip } from './InfoTooltip';
7+
import { CustomInfoTooltip } from './CustomInfoTooltip';
88

99
interface IntegrationStatusIndicatorProps {
1010
campaign: Campaign;
@@ -109,8 +109,8 @@ export const IntegrationStatusIndicator = ({ campaign }: IntegrationStatusIndica
109109
{config.icon}
110110
<span className="text-xs font-medium">{config.label}</span>
111111
</Badge>
112-
<InfoTooltip text={config.description} />
113-
<InfoTooltip text="L'indicateur 'Code' vous montre si votre script de tracking RefSpring est correctement installé sur votre site e-commerce et s'il fonctionne." />
112+
<CustomInfoTooltip text={config.description} />
113+
<CustomInfoTooltip text="L'indicateur 'Code' vous montre si votre script de tracking RefSpring est correctement installé sur votre site e-commerce et s'il fonctionne." />
114114
</div>
115115
);
116116
};

0 commit comments

Comments
 (0)