From ef5bc5243e4dff6a8e9d01116f1f8a29079e80f8 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 14 Oct 2024 21:45:47 +0300 Subject: [PATCH] Use admonitions in settings screens (#5741) --- src/components/Admonition.tsx | 13 ++++++----- src/screens/Messages/Settings.tsx | 25 +++++++--------------- src/view/screens/NotificationsSettings.tsx | 24 +++++++-------------- 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/src/components/Admonition.tsx b/src/components/Admonition.tsx index 7c8682119d..140e838e70 100644 --- a/src/components/Admonition.tsx +++ b/src/components/Admonition.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {View} from 'react-native' +import {StyleProp, View, ViewStyle} from 'react-native' import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {CircleInfo_Stroke2_Corner0_Rounded as ErrorIcon} from '#/components/icons/CircleInfo' @@ -70,9 +70,11 @@ export function Row({children}: {children: React.ReactNode}) { export function Outer({ children, type = 'info', + style, }: { children: React.ReactNode type?: Context['type'] + style?: StyleProp }) { const t = useTheme() const {gtMobile} = useBreakpoints() @@ -90,9 +92,8 @@ export function Outer({ a.rounded_sm, a.border, t.atoms.bg_contrast_25, - { - borderColor, - }, + {borderColor}, + style, ]}> {children} @@ -103,12 +104,14 @@ export function Outer({ export function Admonition({ children, type, + style, }: { children: TextProps['children'] type?: Context['type'] + style?: StyleProp }) { return ( - + {children} diff --git a/src/screens/Messages/Settings.tsx b/src/screens/Messages/Settings.tsx index b1c52582f0..a7b55229f0 100644 --- a/src/screens/Messages/Settings.tsx +++ b/src/screens/Messages/Settings.tsx @@ -12,7 +12,8 @@ import {useSession} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {ViewHeader} from '#/view/com/util/ViewHeader' import {ScrollView} from '#/view/com/util/Views' -import {atoms as a, useTheme} from '#/alf' +import {atoms as a} from '#/alf' +import {Admonition} from '#/components/Admonition' import {Divider} from '#/components/Divider' import * as Toggle from '#/components/forms/Toggle' import {Text} from '#/components/Typography' @@ -23,7 +24,6 @@ type AllowIncoming = 'all' | 'none' | 'following' type Props = NativeStackScreenProps export function MessagesSettingsScreen({}: Props) { const {_} = useLingui() - const t = useTheme() const {currentAccount} = useSession() const {data: profile} = useProfileQuery({ did: currentAccount!.did, @@ -99,21 +99,12 @@ export function MessagesSettingsScreen({}: Props) { - - - - You can continue ongoing conversations regardless of which setting - you choose. - - - + + + You can continue ongoing conversations regardless of which setting + you choose. + + {isNative && ( <> diff --git a/src/view/screens/NotificationsSettings.tsx b/src/view/screens/NotificationsSettings.tsx index 8955119a6b..f395941df9 100644 --- a/src/view/screens/NotificationsSettings.tsx +++ b/src/view/screens/NotificationsSettings.tsx @@ -10,6 +10,7 @@ import {useNotificationsSettingsMutation} from '#/state/queries/notifications/se import {ViewHeader} from '#/view/com/util/ViewHeader' import {ScrollView} from '#/view/com/util/Views' import {atoms as a, useTheme} from '#/alf' +import {Admonition} from '#/components/Admonition' import {Error} from '#/components/Error' import * as Toggle from '#/components/forms/Toggle' import {Loader} from '#/components/Loader' @@ -71,22 +72,13 @@ export function NotificationsSettingsScreen({}: Props) { - - - - Experimental: When this preference is enabled, you'll only - receive reply and quote notifications from users you follow. - We'll continue to add more controls here over time. - - - + + + Experimental: When this preference is enabled, you'll only receive + reply and quote notifications from users you follow. We'll + continue to add more controls here over time. + + )}