-
-
Notifications
You must be signed in to change notification settings - Fork 218
/
Tooltip.tsx
65 lines (62 loc) · 1.61 KB
/
Tooltip.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import * as React from 'react'
import { View, Text, TouchableOpacity } from 'react-native'
import { Button } from './Button'
import styles from './style'
import { IStep, Labels } from '../types'
export interface TooltipProps {
isFirstStep?: boolean
isLastStep?: boolean
currentStep: IStep
labels?: Labels
handleNext?: () => void
handlePrev?: () => void
handleStop?: () => void
}
export const Tooltip = ({
isFirstStep,
isLastStep,
handleNext,
handlePrev,
handleStop,
currentStep,
labels,
}: TooltipProps) => (
<View
style={{
borderRadius: 16,
paddingTop: 24,
alignItems: 'center',
justifyContent: 'center',
paddingBottom: 16,
width: '80%',
backgroundColor: '#ffffffef',
}}
>
<View style={styles.tooltipContainer}>
<Text testID='stepDescription' style={styles.tooltipText}>
{currentStep && currentStep.text}
</Text>
</View>
<View style={[styles.bottomBar]}>
{!isLastStep ? (
<TouchableOpacity onPress={handleStop}>
<Button>{labels?.skip || 'Skip'}</Button>
</TouchableOpacity>
) : null}
{!isFirstStep ? (
<TouchableOpacity onPress={handlePrev}>
<Button>{labels?.previous || 'Previous'}</Button>
</TouchableOpacity>
) : null}
{!isLastStep ? (
<TouchableOpacity onPress={handleNext}>
<Button>{labels?.next || 'Next'}</Button>
</TouchableOpacity>
) : (
<TouchableOpacity onPress={handleStop}>
<Button>{labels?.finish || 'Finish'}</Button>
</TouchableOpacity>
)}
</View>
</View>
)