Skip to content

Commit c754d75

Browse files
committed
updated landing with code improvements
1 parent 4d88ec1 commit c754d75

4 files changed

Lines changed: 63 additions & 98 deletions

File tree

src/screens/HomeScreen.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ export const HomeScreen = () => {
1919
<Text.XxlBold textAlign="center">{t('home_screen.header_title')}</Text.XxlBold>
2020
<Text.LgRegular textAlign="center">{t('home_screen.header_subtitle')}</Text.LgRegular>
2121

22-
<Box
23-
alignItems={'center'}
24-
flexDirection={'row'}
25-
flexWrap={'wrap'}
26-
justifyContent={'center'}
27-
mt={4}
28-
>
22+
<Box alignItems="center" flexDirection="row" flexWrap="wrap" justifyContent="center" mt={4}>
2923
<Button h={12} m={3} maxWidth={160} minWidth={160} onPress={() => openLink(BACA_DOCS_URL)}>
3024
{t('home_screen.read_docs')}
3125
</Button>

src/screens/HomeScreen.web.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/screens/LandingScreen.tsx

Lines changed: 61 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,77 @@
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'
57

68
export const LandingScreen = () => {
79
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+
)
821

922
useScreenOptions({
1023
title: t('navigation.screen_titles.home'),
1124
})
1225

13-
const navigateToBlog = useCallback(() => {
14-
router.navigate('/blog')
15-
}, [])
16-
17-
const navigateToBigForm = useCallback(() => {
18-
router.navigate('/big-form')
19-
}, [])
20-
2126
return (
2227
<KeyboardAwareScrollView>
2328
<LandingHeader />
2429
<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>
3567
</Center>
3668
</KeyboardAwareScrollView>
3769
)
3870
}
71+
72+
const styles = StyleSheet.create({
73+
imageSize: {
74+
height: '100%',
75+
width: '100%',
76+
},
77+
})

src/screens/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ export * from './SettingsScreen'
1515
export * from './TestFormScreen'
1616
export * from './TypographyScreen'
1717
export * from './UserSessionScreen'
18-
export * from '../screens/drafts/images'
18+
export * from './drafts/images'

0 commit comments

Comments
 (0)