146 lines
3.5 KiB
TypeScript
146 lines
3.5 KiB
TypeScript
import React from "react";
|
|
import {
|
|
Modal,
|
|
Pressable,
|
|
StyleSheet,
|
|
Text,
|
|
TouchableOpacity,
|
|
View,
|
|
} from "react-native";
|
|
import { Ionicons } from "@expo/vector-icons";
|
|
import { moderateScale, scale, verticalScale } from "react-native-size-matters";
|
|
|
|
import { Colors } from "@/theme";
|
|
|
|
interface LogoutConfirmModalProps {
|
|
visible: boolean;
|
|
onCancel: () => void;
|
|
onConfirm: () => void;
|
|
}
|
|
|
|
export default function LogoutConfirmModal({
|
|
visible,
|
|
onCancel,
|
|
onConfirm,
|
|
}: LogoutConfirmModalProps) {
|
|
return (
|
|
<Modal
|
|
visible={visible}
|
|
transparent
|
|
animationType="fade"
|
|
onRequestClose={onCancel}
|
|
>
|
|
<Pressable style={styles.backdrop} onPress={onCancel}>
|
|
<Pressable style={styles.card} onPress={() => {}}>
|
|
<View style={styles.iconContainer}>
|
|
<Ionicons name="log-out-outline" size={26} color="#DC2626" />
|
|
</View>
|
|
|
|
<Text style={styles.title}>Log Out</Text>
|
|
<Text style={styles.message}>
|
|
Are you sure you want to log out of Acupedia?
|
|
</Text>
|
|
|
|
<View style={styles.actions}>
|
|
<TouchableOpacity
|
|
style={[styles.button, styles.cancelButton]}
|
|
onPress={onCancel}
|
|
activeOpacity={0.8}
|
|
accessibilityRole="button"
|
|
accessibilityLabel="Cancel"
|
|
>
|
|
<Text style={styles.cancelText}>Cancel</Text>
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity
|
|
style={[styles.button, styles.confirmButton]}
|
|
onPress={onConfirm}
|
|
activeOpacity={0.8}
|
|
accessibilityRole="button"
|
|
accessibilityLabel="Log Out"
|
|
>
|
|
<Text style={styles.confirmText}>Log Out</Text>
|
|
</TouchableOpacity>
|
|
</View>
|
|
</Pressable>
|
|
</Pressable>
|
|
</Modal>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
backdrop: {
|
|
flex: 1,
|
|
backgroundColor: "rgba(15, 23, 42, 0.55)",
|
|
justifyContent: "center",
|
|
alignItems: "center",
|
|
paddingHorizontal: scale(24),
|
|
},
|
|
card: {
|
|
width: "100%",
|
|
maxWidth: 360,
|
|
backgroundColor: Colors.surface ?? "#FFFFFF",
|
|
borderRadius: moderateScale(20),
|
|
padding: moderateScale(22),
|
|
alignItems: "center",
|
|
shadowColor: "#000",
|
|
shadowOffset: { width: 0, height: 10 },
|
|
shadowOpacity: 0.18,
|
|
shadowRadius: 20,
|
|
elevation: 8,
|
|
},
|
|
iconContainer: {
|
|
width: scale(48),
|
|
height: scale(48),
|
|
borderRadius: scale(24),
|
|
backgroundColor: "#FEE2E2",
|
|
justifyContent: "center",
|
|
alignItems: "center",
|
|
marginBottom: verticalScale(12),
|
|
},
|
|
title: {
|
|
fontSize: moderateScale(18),
|
|
fontWeight: "700",
|
|
color: Colors.textPrimary ?? "#0F172A",
|
|
marginBottom: verticalScale(6),
|
|
textAlign: "center",
|
|
},
|
|
message: {
|
|
fontSize: moderateScale(14),
|
|
color: Colors.textSecondary ?? "#475569",
|
|
textAlign: "center",
|
|
lineHeight: moderateScale(20),
|
|
marginBottom: verticalScale(20),
|
|
},
|
|
actions: {
|
|
flexDirection: "row",
|
|
gap: scale(10),
|
|
width: "100%",
|
|
},
|
|
button: {
|
|
flex: 1,
|
|
paddingVertical: verticalScale(11),
|
|
borderRadius: moderateScale(12),
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
},
|
|
cancelButton: {
|
|
backgroundColor: "#F1F5F9",
|
|
borderWidth: 1,
|
|
borderColor: "#E2E8F0",
|
|
},
|
|
confirmButton: {
|
|
backgroundColor: "#DC2626",
|
|
},
|
|
cancelText: {
|
|
fontSize: moderateScale(14),
|
|
fontWeight: "600",
|
|
color: "#334155",
|
|
},
|
|
confirmText: {
|
|
fontSize: moderateScale(14),
|
|
fontWeight: "700",
|
|
color: "#FFFFFF",
|
|
},
|
|
});
|