Fix layout of NotFound screen and convert to ALF (#10649)
This commit is contained in:
@@ -1,21 +1,17 @@
|
||||
import {useCallback} from 'react'
|
||||
import {StyleSheet, View} from 'react-native'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
import {View} from 'react-native'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
import {StackActions, useNavigation} from '@react-navigation/native'
|
||||
|
||||
import {usePalette} from '#/lib/hooks/usePalette'
|
||||
import {type NavigationProp} from '#/lib/routes/types'
|
||||
import {s} from '#/lib/styles'
|
||||
import {Button} from '#/view/com/util/forms/Button'
|
||||
import {Text} from '#/view/com/util/text/Text'
|
||||
import {ViewHeader} from '#/view/com/util/ViewHeader'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {Button, ButtonText} from '#/components/Button'
|
||||
import * as Layout from '#/components/Layout'
|
||||
import {Text} from '#/components/Typography'
|
||||
|
||||
export const NotFoundScreen = () => {
|
||||
const pal = usePalette('default')
|
||||
const {_} = useLingui()
|
||||
const t = useTheme()
|
||||
const {t: l} = useLingui()
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
|
||||
const canGoBack = navigation.canGoBack()
|
||||
@@ -30,37 +26,38 @@ export const NotFoundScreen = () => {
|
||||
|
||||
return (
|
||||
<Layout.Screen testID="notFoundView">
|
||||
<ViewHeader title={_(msg`Page Not Found`)} />
|
||||
<View style={styles.container}>
|
||||
<Text type="title-2xl" style={[pal.text, s.mb10]}>
|
||||
<Trans>Page not found</Trans>
|
||||
</Text>
|
||||
<Text type="md" style={[pal.text, s.mb10]}>
|
||||
<Trans>
|
||||
We're sorry! We can't find the page you were looking for.
|
||||
</Trans>
|
||||
</Text>
|
||||
<Button
|
||||
type="primary"
|
||||
label={canGoBack ? _(msg`Go Back`) : _(msg`Go Home`)}
|
||||
accessibilityLabel={canGoBack ? _(msg`Go back`) : _(msg`Go home`)}
|
||||
accessibilityHint={
|
||||
canGoBack
|
||||
? _(msg`Returns to previous page`)
|
||||
: _(msg`Returns to home page`)
|
||||
}
|
||||
onPress={onPressHome}
|
||||
/>
|
||||
</View>
|
||||
<Layout.Center>
|
||||
<Layout.Header.Outer>
|
||||
<Layout.Header.BackButton />
|
||||
<Layout.Header.Content align="left">
|
||||
<Layout.Header.TitleText>
|
||||
<Trans>Page not found</Trans>
|
||||
</Layout.Header.TitleText>
|
||||
</Layout.Header.Content>
|
||||
<Layout.Header.Slot />
|
||||
</Layout.Header.Outer>
|
||||
<View style={[a.px_xl, a.align_center, a.h_full, {paddingTop: 100}]}>
|
||||
<Text style={[a.mb_md, a.text_4xl, a.font_semi_bold, t.atoms.text]}>
|
||||
<Trans>Page not found</Trans>
|
||||
</Text>
|
||||
<Text style={[a.mb_md, a.text_md, t.atoms.text]}>
|
||||
<Trans>
|
||||
We're sorry! We can't find the page you were looking for.
|
||||
</Trans>
|
||||
</Text>
|
||||
<Button
|
||||
color="primary"
|
||||
size="small"
|
||||
label={canGoBack ? l`Go back` : l`Go home`}
|
||||
accessibilityLabel={canGoBack ? l`Go back` : l`Go home`}
|
||||
accessibilityHint={
|
||||
canGoBack ? l`Returns to previous page` : l`Returns to home page`
|
||||
}
|
||||
onPress={onPressHome}>
|
||||
<ButtonText>{canGoBack ? l`Go back` : l`Go home`}</ButtonText>
|
||||
</Button>
|
||||
</View>
|
||||
</Layout.Center>
|
||||
</Layout.Screen>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
paddingTop: 100,
|
||||
paddingHorizontal: 20,
|
||||
alignItems: 'center',
|
||||
height: '100%',
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user