c8f264b78b
* start building storybook * add title * add some styles * try out new icons * more settings list component parts * make text do the spacing * clean up storybook * gated new settings screen * switch account * add current profile * use Layout.Screen * Layout.Header and Layout.Content * translate helpdesk text thanks @surfdude29! Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * add account settings * undo changes to export car dialog * privacy and security screen * Translate protect account stuff Thanks @surfdude29! Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * content and media settings * about settings * 2fa copy Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * a11y and appearance * use new components for appearance settings * redesign accessibility settings * Update ContentAndMediaSettings.tsx Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * add divider * remove a11y and appearance middleman screen * fix web settingslist styles * new SettingsList.Group component * explain how portal magic works * hide pwioptout in old location * Update Settings.tsx Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * replace gate with `IS_INTERNAL` * add IS_INTERNAL to app-info.web * fix profile area growing * add close button to switch account --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
156 lines
4.6 KiB
TypeScript
156 lines
4.6 KiB
TypeScript
import React from 'react'
|
|
import {ScrollView, View} from 'react-native'
|
|
import {useNavigation} from '@react-navigation/native'
|
|
|
|
import {NavigationProp} from '#/lib/routes/types'
|
|
import {isWeb} from '#/platform/detection'
|
|
import {useSetThemePrefs} from '#/state/shell'
|
|
import {CenteredView} from '#/view/com/util/Views'
|
|
import {ListContained} from '#/view/screens/Storybook/ListContained'
|
|
import {atoms as a, ThemeProvider, useTheme} from '#/alf'
|
|
import {Button, ButtonText} from '#/components/Button'
|
|
import * as Layout from '#/components/Layout'
|
|
import {Admonitions} from './Admonitions'
|
|
import {Breakpoints} from './Breakpoints'
|
|
import {Buttons} from './Buttons'
|
|
import {Dialogs} from './Dialogs'
|
|
import {Forms} from './Forms'
|
|
import {Icons} from './Icons'
|
|
import {Links} from './Links'
|
|
import {Menus} from './Menus'
|
|
import {Settings} from './Settings'
|
|
import {Shadows} from './Shadows'
|
|
import {Spacing} from './Spacing'
|
|
import {Theming} from './Theming'
|
|
import {Typography} from './Typography'
|
|
|
|
export function Storybook() {
|
|
return (
|
|
<Layout.Screen>
|
|
{isWeb ? (
|
|
<StorybookInner />
|
|
) : (
|
|
<ScrollView>
|
|
<StorybookInner />
|
|
</ScrollView>
|
|
)}
|
|
</Layout.Screen>
|
|
)
|
|
}
|
|
|
|
function StorybookInner() {
|
|
const t = useTheme()
|
|
const {setColorMode, setDarkTheme} = useSetThemePrefs()
|
|
const [showContainedList, setShowContainedList] = React.useState(false)
|
|
const navigation = useNavigation<NavigationProp>()
|
|
|
|
return (
|
|
<CenteredView style={[t.atoms.bg]}>
|
|
<View style={[a.p_xl, a.gap_5xl, {paddingBottom: 100}]}>
|
|
{!showContainedList ? (
|
|
<>
|
|
<View style={[a.flex_row, a.align_start, a.gap_md]}>
|
|
<Button
|
|
variant="outline"
|
|
color="primary"
|
|
size="small"
|
|
label='Set theme to "system"'
|
|
onPress={() => setColorMode('system')}>
|
|
<ButtonText>System</ButtonText>
|
|
</Button>
|
|
<Button
|
|
variant="solid"
|
|
color="secondary"
|
|
size="small"
|
|
label='Set theme to "light"'
|
|
onPress={() => setColorMode('light')}>
|
|
<ButtonText>Light</ButtonText>
|
|
</Button>
|
|
<Button
|
|
variant="solid"
|
|
color="secondary"
|
|
size="small"
|
|
label='Set theme to "dim"'
|
|
onPress={() => {
|
|
setColorMode('dark')
|
|
setDarkTheme('dim')
|
|
}}>
|
|
<ButtonText>Dim</ButtonText>
|
|
</Button>
|
|
<Button
|
|
variant="solid"
|
|
color="secondary"
|
|
size="small"
|
|
label='Set theme to "dark"'
|
|
onPress={() => {
|
|
setColorMode('dark')
|
|
setDarkTheme('dark')
|
|
}}>
|
|
<ButtonText>Dark</ButtonText>
|
|
</Button>
|
|
</View>
|
|
|
|
<Button
|
|
variant="solid"
|
|
color="primary"
|
|
size="small"
|
|
onPress={() => navigation.navigate('SharedPreferencesTester')}
|
|
label="two"
|
|
testID="sharedPrefsTestOpenBtn">
|
|
<ButtonText>Open Shared Prefs Tester</ButtonText>
|
|
</Button>
|
|
|
|
<Admonitions />
|
|
|
|
<Settings />
|
|
|
|
<ThemeProvider theme="light">
|
|
<Theming />
|
|
</ThemeProvider>
|
|
<ThemeProvider theme="dim">
|
|
<Theming />
|
|
</ThemeProvider>
|
|
<ThemeProvider theme="dark">
|
|
<Theming />
|
|
</ThemeProvider>
|
|
|
|
<Forms />
|
|
<Buttons />
|
|
<Typography />
|
|
<Spacing />
|
|
<Shadows />
|
|
<Buttons />
|
|
<Icons />
|
|
<Links />
|
|
<Dialogs />
|
|
<Menus />
|
|
<Breakpoints />
|
|
<Dialogs />
|
|
|
|
<Button
|
|
variant="solid"
|
|
color="primary"
|
|
size="large"
|
|
label="Switch to Contained List"
|
|
onPress={() => setShowContainedList(true)}>
|
|
<ButtonText>Switch to Contained List</ButtonText>
|
|
</Button>
|
|
</>
|
|
) : (
|
|
<>
|
|
<Button
|
|
variant="solid"
|
|
color="primary"
|
|
size="large"
|
|
label="Switch to Storybook"
|
|
onPress={() => setShowContainedList(false)}>
|
|
<ButtonText>Switch to Storybook</ButtonText>
|
|
</Button>
|
|
<ListContained />
|
|
</>
|
|
)}
|
|
</View>
|
|
</CenteredView>
|
|
)
|
|
}
|