import React from "react"; import { View, StyleSheet, Linking } from "react-native"; import { useAppDesignTokens } from "@umituz/react-native-design-system/theme"; import { AtomicText, AtomicButton } from "@umituz/react-native-design-system/atoms"; export interface AuthLegalLinksTranslations { termsOfService: string; privacyPolicy: string; } interface AuthLegalLinksProps { translations: AuthLegalLinksTranslations; termsUrl?: string; privacyUrl?: string; onTermsPress?: () => void; onPrivacyPress?: () => void; prefixText?: string; } export const AuthLegalLinks: React.FC = ({ translations, termsUrl, privacyUrl, onTermsPress, onPrivacyPress, prefixText, }) => { const tokens = useAppDesignTokens(); const handleTermsPress = async () => { if (onTermsPress) { onTermsPress(); } else if (termsUrl) { await Linking.openURL(termsUrl); } }; const handlePrivacyPress = async () => { if (onPrivacyPress) { onPrivacyPress(); } else if (privacyUrl) { await Linking.openURL(privacyUrl); } }; if (!termsUrl && !privacyUrl && !onTermsPress && !onPrivacyPress) { return null; } return ( {prefixText && ( {prefixText} )} {(termsUrl || onTermsPress) && ( { void handleTermsPress(); }} > {translations.termsOfService} )} {(termsUrl || onTermsPress) && (privacyUrl || onPrivacyPress) && ( & )} {(privacyUrl || onPrivacyPress) && ( { void handlePrivacyPress(); }} > {translations.privacyPolicy} )} ); }; const styles = StyleSheet.create({ container: { alignItems: "center", }, prefix: { marginBottom: 4, }, linksRow: { flexDirection: "row", alignItems: "center", }, });