|
1 | | -import { CompanyLogo, KeyboardAwareScrollView, LandingHeader } from '@baca/components' |
2 | | -import { Button, Center, Text } from '@baca/design-system' |
3 | | -import { useCallback, useScreenOptions, useTranslation } from '@baca/hooks' |
4 | | -import { router } from 'expo-router' |
| 1 | +import { KeyboardAwareScrollView, LandingHeader } from '@baca/components' |
| 2 | +import { BACA_APP_URL, BACA_DOCS_URL } from '@baca/constants' |
| 3 | +import { Button, Center, Text, Box, ScrollView } from '@baca/design-system' |
| 4 | +import { useCallback, useScreenOptions, useTranslation, useViewportDimensions } from '@baca/hooks' |
| 5 | +import { draftImages } from '@baca/screens' |
| 6 | +import { ImageSourcePropType, Linking, Image, StyleSheet } from 'react-native' |
5 | 7 |
|
6 | 8 | export const LandingScreen = () => { |
7 | 9 | const { t } = useTranslation() |
| 10 | + const { viewportWidth, viewportHeight } = useViewportDimensions() |
| 11 | + |
| 12 | + useScreenOptions({ title: t('navigation.screen_titles.home') }) |
| 13 | + |
| 14 | + const openLink = useCallback((url: string) => Linking.openURL(url), []) |
| 15 | + |
| 16 | + const renderItem = (item: ImageSourcePropType, index: number) => ( |
| 17 | + <Box key={index} height={viewportHeight * 0.6} width={viewportWidth * 0.6}> |
| 18 | + <Image source={item} resizeMode="contain" style={styles.imageSize} /> |
| 19 | + </Box> |
| 20 | + ) |
8 | 21 |
|
9 | 22 | useScreenOptions({ |
10 | 23 | title: t('navigation.screen_titles.home'), |
11 | 24 | }) |
12 | 25 |
|
13 | | - const navigateToBlog = useCallback(() => { |
14 | | - router.navigate('/blog') |
15 | | - }, []) |
16 | | - |
17 | | - const navigateToBigForm = useCallback(() => { |
18 | | - router.navigate('/big-form') |
19 | | - }, []) |
20 | | - |
21 | 26 | return ( |
22 | 27 | <KeyboardAwareScrollView> |
23 | 28 | <LandingHeader /> |
24 | 29 | <Center flex={1} px={4}> |
25 | | - <CompanyLogo /> |
26 | | - <Text.LgBold textAlign="center">{t('hello')}</Text.LgBold> |
27 | | - <Text.MdRegular textAlign="center">{t('thanks')}</Text.MdRegular> |
28 | | - <Text.MdRegular textAlign="center">{t('app_information')}</Text.MdRegular> |
29 | | - <Button mt={4} onPress={navigateToBigForm}> |
30 | | - {t('landing_screen.go_to_form')} |
31 | | - </Button> |
32 | | - <Button mt={4} onPress={navigateToBlog}> |
33 | | - {t('landing_screen.go_to_blog')} |
34 | | - </Button> |
| 30 | + <Text.XxlBold mt={20} textAlign="center"> |
| 31 | + {t('home_screen.header_title')} |
| 32 | + </Text.XxlBold> |
| 33 | + <Text.LgRegular textAlign="center">{t('home_screen.header_subtitle')}</Text.LgRegular> |
| 34 | + |
| 35 | + <Box alignItems="center" flexDirection="row" flexWrap="wrap" justifyContent="center" mt={4}> |
| 36 | + <Button |
| 37 | + m={3} |
| 38 | + h={12} |
| 39 | + minWidth={160} |
| 40 | + maxWidth={160} |
| 41 | + onPress={() => openLink(BACA_DOCS_URL)} |
| 42 | + > |
| 43 | + {t('home_screen.read_docs')} |
| 44 | + </Button> |
| 45 | + <Button.SecondaryColor |
| 46 | + m={3} |
| 47 | + h={12} |
| 48 | + minWidth={160} |
| 49 | + maxWidth={160} |
| 50 | + onPress={() => openLink(BACA_APP_URL)} |
| 51 | + > |
| 52 | + {t('home_screen.try_it')} |
| 53 | + </Button.SecondaryColor> |
| 54 | + </Box> |
| 55 | + |
| 56 | + <ScrollView |
| 57 | + height={viewportHeight * 0.6} |
| 58 | + horizontal |
| 59 | + mt={8} |
| 60 | + pagingEnabled |
| 61 | + scrollEventThrottle={16} |
| 62 | + showsHorizontalScrollIndicator={false} |
| 63 | + width={viewportWidth * 0.6} |
| 64 | + > |
| 65 | + {draftImages.map(renderItem)} |
| 66 | + </ScrollView> |
35 | 67 | </Center> |
36 | 68 | </KeyboardAwareScrollView> |
37 | 69 | ) |
38 | 70 | } |
| 71 | + |
| 72 | +const styles = StyleSheet.create({ |
| 73 | + imageSize: { |
| 74 | + height: '100%', |
| 75 | + width: '100%', |
| 76 | + }, |
| 77 | +}) |
0 commit comments