Skip to content

Commit 33d125c

Browse files
committed
Add close icon, improve formatting
1 parent 47513af commit 33d125c

File tree

2 files changed

+49
-48
lines changed

2 files changed

+49
-48
lines changed

ts/features/tour/components/TourOverlay.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const OVERLAY_COLOR = "rgba(0,0,0,0.5)";
3030
const CUTOUT_BORDER_RADIUS = 8;
3131
const CUTOUT_PADDING = 0;
3232
const ANIMATION_DURATION = 350;
33-
const STEP_EASING = Easing.inOut(Easing.exp);
33+
const STEP_EASING = Easing.inOut(Easing.quad);
3434

3535
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("screen");
3636

@@ -141,15 +141,16 @@ export const TourOverlay = () => {
141141
};
142142
cutoutOpacity.value = withTiming(
143143
0,
144-
{ duration: ANIMATION_DURATION },
144+
{ duration: ANIMATION_DURATION, easing: STEP_EASING },
145145
() => {
146146
cutoutX.value = padded.x;
147147
cutoutY.value = padded.y;
148148
cutoutW.value = padded.width;
149149
cutoutH.value = padded.height;
150150
runOnJS(updateStepUI)();
151151
cutoutOpacity.value = withTiming(1, {
152-
duration: ANIMATION_DURATION
152+
duration: ANIMATION_DURATION,
153+
easing: STEP_EASING
153154
});
154155
}
155156
);

ts/features/tour/components/TourTooltip.tsx

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import {
22
Body,
33
H6,
4-
HSpacer,
4+
HStack,
5+
IconButton,
56
IOButton,
67
IOColors,
78
useIOTheme,
8-
VSpacer
9+
VStack
910
} from "@pagopa/io-app-design-system";
1011
import { useCallback, useState } from "react";
1112
import { Dimensions, StyleSheet, View } from "react-native";
@@ -123,43 +124,51 @@ export const TourTooltip = ({
123124
]}
124125
/>
125126
<View style={[styles.tooltip, { backgroundColor: tooltipBgColor }]}>
126-
<H6>{title}</H6>
127-
<VSpacer size={4} />
128-
<Body>{description}</Body>
129-
<VSpacer size={8} />
130-
<Body weight="Semibold">{`${stepIndex + 1} / ${totalSteps}`}</Body>
131-
<VSpacer size={16} />
132-
<View style={styles.buttonsRow}>
133-
<IOButton
134-
variant="link"
135-
color="primary"
136-
label={I18n.t("features.tour.skip")}
137-
onPress={handleSkip}
138-
/>
139-
<View style={styles.rightButtons}>
140-
{!isFirstStep && (
141-
<>
127+
<VStack space={16}>
128+
<VStack space={4}>
129+
<HStack
130+
space={8}
131+
style={{
132+
justifyContent: "space-between",
133+
alignItems: "flex-start"
134+
}}
135+
>
136+
<H6 style={{ flexShrink: 1 }}>{title}</H6>
137+
<IconButton
138+
icon="closeSmall"
139+
color="neutral"
140+
accessibilityLabel={I18n.t("features.tour.skip")}
141+
onPress={handleSkip}
142+
/>
143+
</HStack>
144+
<Body>{description}</Body>
145+
</VStack>
146+
<HStack
147+
style={{ justifyContent: "space-between", alignItems: "center" }}
148+
>
149+
<Body weight="Semibold">{`${stepIndex + 1} / ${totalSteps}`}</Body>
150+
<HStack space={8} style={{ alignItems: "center" }}>
151+
{!isFirstStep && (
142152
<IOButton
143153
variant="link"
144154
color="primary"
145155
label={I18n.t("features.tour.back")}
146156
onPress={handleBack}
147157
/>
148-
<HSpacer size={8} />
149-
</>
150-
)}
151-
<IOButton
152-
variant="link"
153-
color="primary"
154-
label={
155-
isLastStep
156-
? I18n.t("features.tour.done")
157-
: I18n.t("features.tour.next")
158-
}
159-
onPress={handleNext}
160-
/>
161-
</View>
162-
</View>
158+
)}
159+
<IOButton
160+
variant="link"
161+
color="primary"
162+
label={
163+
isLastStep
164+
? I18n.t("features.tour.done")
165+
: I18n.t("features.tour.next")
166+
}
167+
onPress={handleNext}
168+
/>
169+
</HStack>
170+
</HStack>
171+
</VStack>
163172
</View>
164173
</Animated.View>
165174
);
@@ -168,28 +177,19 @@ export const TourTooltip = ({
168177
const styles = StyleSheet.create({
169178
container: {
170179
position: "absolute",
171-
zIndex: 10000
180+
zIndex: 100
172181
},
173182
tooltip: {
174183
borderRadius: BORDER_RADIUS,
175184
borderCurve: "continuous",
176-
padding: 16,
177-
boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.15)"
185+
boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.15)",
186+
padding: 16
178187
},
179188
arrow: {
180189
position: "absolute",
181190
width: ARROW_SIZE,
182191
height: ARROW_SIZE,
183192
transform: [{ rotate: "45deg" }],
184193
zIndex: 2
185-
},
186-
buttonsRow: {
187-
flexDirection: "row",
188-
justifyContent: "space-between",
189-
alignItems: "center"
190-
},
191-
rightButtons: {
192-
flexDirection: "row",
193-
alignItems: "center"
194194
}
195195
});

0 commit comments

Comments
 (0)