@@ -3,7 +3,7 @@ import { BACA_APP_URL, BACA_DOCS_URL } from '@baca/constants'
33import { Button , Center , Text , Box } from '@baca/design-system'
44import { useCallback , useScreenOptions , useTranslation } from '@baca/hooks'
55import { draftImages } from '@baca/screens'
6- import { useState , useEffect } from 'react'
6+ import { useState , useEffect , useMemo } from 'react'
77import { ImageSourcePropType , Linking , Image , Dimensions , StyleSheet } from 'react-native'
88
99export const LandingScreen = ( ) => {
@@ -16,22 +16,35 @@ export const LandingScreen = () => {
1616 return ( ) => subscription ?. remove ( )
1717 } , [ ] )
1818
19- let numColumns
20- if ( screenWidth >= 1100 ) {
21- numColumns = 4
22- } else if ( screenWidth <= 767 ) {
23- numColumns = 2
24- } else {
25- numColumns = 4
26- }
19+ const imageWidth = useMemo ( ( ) => {
20+ if ( screenWidth >= 1100 ) {
21+ return '25%'
22+ } else if ( screenWidth >= 767 ) {
23+ return '50%'
24+ } else {
25+ return '100%'
26+ }
27+ } , [ screenWidth ] )
2728
28- const imageSize = screenWidth / numColumns - 16
29+ const paddingBetweenImages = useMemo ( ( ) => {
30+ if ( screenWidth >= 1100 ) {
31+ return 2
32+ } else if ( screenWidth >= 767 ) {
33+ return 8
34+ } else if ( screenWidth <= 400 ) {
35+ return 4
36+ } else {
37+ return 16
38+ }
39+ } , [ screenWidth ] )
2940
3041 const openLink = useCallback ( ( url : string ) => Linking . openURL ( url ) , [ ] )
3142
3243 const renderItem = ( item : ImageSourcePropType , index : number ) => (
33- < Box key = { index } height = { imageSize } width = { imageSize } style = { styles . imagesContainer } >
34- < Image source = { item } resizeMode = "contain" style = { styles . imageSize } />
44+ < Box key = { index } width = { imageWidth } px = { paddingBetweenImages } pb = { paddingBetweenImages } >
45+ < Box style = { { aspectRatio : 9 / 16 } } height = "100%" borderRadius = { 16 } bg = "bg.active" >
46+ < Image source = { item } resizeMode = "contain" style = { styles . imageSize } />
47+ </ Box >
3548 </ Box >
3649 )
3750
@@ -42,34 +55,31 @@ export const LandingScreen = () => {
4255 return (
4356 < KeyboardAwareScrollView >
4457 < LandingHeader />
45- < Center flex = { 1 } px = { 4 } >
46- < Text . XxlBold mt = { 20 } textAlign = "center" >
58+ < Center bg = "bg.brand.section" flex = { 1 } px = { 4 } >
59+ < Text . XxlBold fontSize = { 40 } mt = { 20 } color = "text.white" textAlign = "center" >
4760 { t ( 'home_screen.header_title' ) }
4861 </ Text . XxlBold >
49- < Text . LgRegular textAlign = "center" > { t ( 'home_screen.header_subtitle' ) } </ Text . LgRegular >
62+ < Text . LgRegular color = "text.white" textAlign = "center" >
63+ { t ( 'home_screen.header_subtitle' ) }
64+ </ Text . LgRegular >
5065
5166 < Box alignItems = "center" flexDirection = "row" flexWrap = "wrap" justifyContent = "center" mt = { 4 } >
52- < Button
53- m = { 3 }
54- h = { 12 }
55- minWidth = { 160 }
56- maxWidth = { 160 }
57- onPress = { ( ) => openLink ( BACA_DOCS_URL ) }
58- >
67+ < Button m = { 3 } h = { 12 } minWidth = { 160 } onPress = { ( ) => openLink ( BACA_DOCS_URL ) } >
5968 { t ( 'home_screen.read_docs' ) }
6069 </ Button >
61- < Button . SecondaryColor
62- m = { 3 }
63- h = { 12 }
64- minWidth = { 160 }
65- maxWidth = { 160 }
66- onPress = { ( ) => openLink ( BACA_APP_URL ) }
67- >
70+ < Button . SecondaryColor m = { 3 } h = { 12 } minWidth = { 160 } onPress = { ( ) => openLink ( BACA_APP_URL ) } >
6871 { t ( 'home_screen.try_it' ) }
6972 </ Button . SecondaryColor >
7073 </ Box >
7174
72- < Box flexDirection = "row" flexWrap = "wrap" justifyContent = "center" mt = { 4 } >
75+ < Box
76+ flexDirection = "row"
77+ flexWrap = "wrap"
78+ justifyContent = "center"
79+ mt = { 4 }
80+ width = { screenWidth - 16 }
81+ px = { `${ 16 } px` }
82+ >
7383 { draftImages . map ( renderItem ) }
7484 </ Box >
7585 </ Center >
@@ -79,10 +89,8 @@ export const LandingScreen = () => {
7989
8090const styles = StyleSheet . create ( {
8191 imageSize : {
92+ borderRadius : 16 ,
8293 height : '100%' ,
8394 width : '100%' ,
8495 } ,
85- imagesContainer : {
86- padding : 6 ,
87- } ,
8896} )
0 commit comments