diff --git a/src/screens/Settings/AppearanceSettings.tsx b/src/screens/Settings/AppearanceSettings.tsx index 2650d67e20..d675fb38ed 100644 --- a/src/screens/Settings/AppearanceSettings.tsx +++ b/src/screens/Settings/AppearanceSettings.tsx @@ -16,6 +16,7 @@ import {SimpleViewHeader} from '#/view/com/util/SimpleViewHeader' import {ScrollView} from '#/view/com/util/Views' import {atoms as a, native, useAlf, useTheme} from '#/alf' import * as ToggleButton from '#/components/forms/ToggleButton' +import {Props as SVGIconProps} from '#/components/icons/common' import {Moon_Stroke2_Corner0_Rounded as MoonIcon} from '#/components/icons/Moon' import {Phone_Stroke2_Corner0_Rounded as PhoneIcon} from '#/components/icons/Phone' import {TextSize_Stroke2_Corner0_Rounded as TextSize} from '#/components/icons/TextSize' @@ -32,9 +33,6 @@ export function AppearanceSettingsScreen({}: Props) { const {colorMode, darkTheme} = useThemePrefs() const {setColorMode, setDarkTheme} = useSetThemePrefs() - const [fontFamily, setFontFamily] = React.useState(fonts.family) - const [fontScale, setFontScale] = React.useState(() => fonts.scale) - const onChangeAppearance = useCallback( (keys: string[]) => { const appearance = keys.find(key => key !== colorMode) as @@ -63,19 +61,17 @@ export function AppearanceSettingsScreen({}: Props) { const onChangeFontFamily = useCallback( (values: string[]) => { const next = values[0] === 'system' ? 'system' : 'theme' - setFontFamily(next) fonts.setFontFamily(next) }, - [setFontFamily, fonts], + [fonts], ) const onChangeFontScale = useCallback( (values: string[]) => { const next = values[0] || ('0' as any) - setFontScale(next) fonts.setFontScale(next) }, - [setFontScale, fonts], + [fonts], ) return ( @@ -97,133 +93,90 @@ export function AppearanceSettingsScreen({}: Props) { - - - - - Mode - - - - - - System - - - - - Light - - - - - Dark - - - - + {colorMode !== 'light' && ( - - - - Dark theme - - - - + - - - Dim - - - - - Dark - - - + onChange={onChangeDarkTheme} + /> )} - - - - - - Font - - - - - For the best experience, we recommend using the theme - font. - - - - - - - System - - - - - Theme - - - - + - - - - - - Font size - - - - - - - - Smaller - - - - - Default - - - - - Larger - - - - + @@ -231,3 +184,50 @@ export function AppearanceSettingsScreen({}: Props) { ) } + +export function AppearanceToggleButtonGroup({ + title, + description, + icon: Icon, + items, + values, + onChange, +}: { + title: string + description?: string + icon: React.ComponentType + items: { + label: string + name: string + }[] + values: string[] + onChange: (values: string[]) => void +}) { + const t = useTheme() + return ( + + + + + {title} + + {description && ( + + {description} + + )} + + + {items.map(item => ( + + {item.label} + + ))} + + + ) +}