1
1
import { useState , useEffect , type ReactNode } from 'react'
2
2
import { Tooltip } from 'react-tooltip'
3
+ import './ToolTipGuide.css'
3
4
4
5
export interface TooltipStep {
5
6
id : string
@@ -43,13 +44,24 @@ const TooltipGuide = ({
43
44
}
44
45
}
45
46
47
+ const handleSkip = ( ) => {
48
+ setShowTooltips ( false )
49
+ onComplete ?.( )
50
+ }
51
+
46
52
const renderTooltipContent = ( content : string ) => {
47
53
return (
48
54
< div className = "flex flex-col gap-3" >
49
55
< div className = "text-base leading-relaxed" >
50
56
{ content }
51
57
</ div >
52
- < div className = "flex justify-end" >
58
+ < div className = "flex justify-between items-center" >
59
+ < button
60
+ onClick = { handleSkip }
61
+ className = "bg-transparent hover:bg-white/10 text-white/70 hover:text-white px-3 py-1.5 rounded-md text-sm transition-all duration-200 font-medium cursor-pointer border border-white/20"
62
+ >
63
+ Skip
64
+ </ button >
53
65
< button
54
66
onClick = { handleNextStep }
55
67
className = "bg-white/20 hover:bg-white/30 text-white px-3 py-1.5 rounded-md text-sm transition-all duration-200 font-medium cursor-pointer"
@@ -64,27 +76,32 @@ const TooltipGuide = ({
64
76
return (
65
77
< >
66
78
{ children ( showTooltips ) }
67
- { showTooltips && steps . map ( ( step , index ) => (
68
- < Tooltip
69
- key = { step . id }
70
- id = { step . id }
71
- place = { step . placement || 'top' }
72
- isOpen = { showTooltips && currentStep === index }
73
- clickable = { true }
74
- style = { {
75
- backgroundColor : '#9400FF' ,
76
- color : 'white' ,
77
- borderRadius : '12px' ,
78
- padding : '16px' ,
79
- fontSize : '20px' ,
80
- maxWidth : '350px' ,
81
- zIndex : showTooltips && currentStep === index ? 10000 : 9999 ,
82
- boxShadow : '0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1)'
83
- } }
84
- >
85
- { renderTooltipContent ( step . content ) }
86
- </ Tooltip >
87
- ) ) }
79
+ { showTooltips && steps . map ( ( step , index ) => {
80
+ const isCurrentStep = currentStep === index
81
+ return (
82
+ < Tooltip
83
+ key = { step . id }
84
+ id = { step . id }
85
+ place = { step . placement || 'top' }
86
+ isOpen = { isCurrentStep }
87
+ clickable = { true }
88
+ className = "force-opacity-1"
89
+ style = { {
90
+ backgroundColor : '#9400FF' ,
91
+ color : 'white' ,
92
+ borderRadius : '12px' ,
93
+ padding : '16px' ,
94
+ fontSize : '20px' ,
95
+ maxWidth : '350px' ,
96
+ zIndex : isCurrentStep ? 10000 : - 1 ,
97
+ boxShadow : '0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1)' ,
98
+ opacity : 1 ,
99
+ } }
100
+ >
101
+ { renderTooltipContent ( step . content ) }
102
+ </ Tooltip >
103
+ )
104
+ } ) }
88
105
</ >
89
106
)
90
107
}
0 commit comments