Skip to content
TypeScript

refactor(mobile): use shared legal document controls (#21914)

Julius Marminge3e0f501c7d3c
diff --git a/apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx b/apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx
index dd177b8d65e..e9372fc75eb 100644
--- a/apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx
@@ -3,6 +3,8 @@ import { useCallback, useLayoutEffect, useState } from "react";
import { Linking, Pressable, View } from "react-native";
import { WebView } from "react-native-webview";
+import { Button } from "../../../components/ui/Button";
+import { IconButton } from "../../../components/ui/IconButton";
import { AppActivityIndicator } from "../../../components/ui/AppActivityIndicator";
import { AppText as Text } from "../../../components/ui/AppText";
import { LoadingStrip } from "../../../components/ui/LoadingStrip";
@@ -13,21 +15,11 @@ export function SettingsLegalDocumentCloseHeaderButton() {
const navigation = useNavigation();
return (
- <Pressable
+ <IconButton
accessibilityLabel="Close legal document"
- accessibilityRole="button"
- hitSlop={12}
+ icon="xmark"
onPress={() => navigation.goBack()}
- className="p-2 active:opacity-60"
- >
- <SymbolView
- name="xmark"
- size={18}
- tintColorClassName={"accent-icon"}
- type="monochrome"
- weight="semibold"
- />
- </Pressable>
+ />
);
}
@@ -39,21 +31,11 @@ export function SettingsLegalDocumentExternalHeaderButton({
const safeExternalUrl = isLegalDocumentUrl(externalUrl) ? externalUrl : LEGAL_URL;
return (
- <Pressable
+ <IconButton
accessibilityLabel="Open legal documents in external browser"
- accessibilityRole="button"
- hitSlop={12}
+ icon="safari"
onPress={() => void Linking.openURL(safeExternalUrl).catch(() => undefined)}
- className="p-2 active:opacity-60"
- >
- <SymbolView
- name="safari"
- size={19}
- tintColorClassName={"accent-icon"}
- type="monochrome"
- weight="regular"
- />
- </Pressable>
+ />
);
}
@@ -104,16 +86,15 @@ export function SettingsLegalDocumentRouteScreen({
</Text>
</View>
<View className="w-full max-w-[320px] gap-2">
- <Pressable
- accessibilityRole="button"
+ <Button
+ label="Try Again"
+ tone="contrast"
+ fullWidth
onPress={() => {
setLoadError(null);
setReloadKey((value) => value + 1);
}}
- className="items-center rounded-xl bg-foreground px-4 py-3 active:opacity-80"
- >
- <Text className="font-t3-bold text-base text-sheet">Try Again</Text>
- </Pressable>
+ />
<Pressable
accessibilityRole="link"
onPress={() => openExternalUrl(documentUrl)}