Browse Source

Improved ui on larger screens

Arnaud Vergnet 4 years ago
parent
commit
3bc45704f6

+ 6
- 2
screens/Tetris/TetrisScreen.js View File

199
                 <View style={{
199
                 <View style={{
200
                     flexDirection: 'row',
200
                     flexDirection: 'row',
201
                     position: 'absolute',
201
                     position: 'absolute',
202
-                    top: 10,
202
+                    top: 5,
203
                     left: 10,
203
                     left: 10,
204
                 }}>
204
                 }}>
205
                     <MaterialCommunityIcons
205
                     <MaterialCommunityIcons
242
                 <Grid
242
                 <Grid
243
                     width={this.logic.getWidth()}
243
                     width={this.logic.getWidth()}
244
                     height={this.logic.getHeight()}
244
                     height={this.logic.getHeight()}
245
-                    containerHeight={'80%'}
245
+                    containerMaxHeight={'80%'}
246
+                    containerMaxWidth={'60%'}
246
                     grid={this.state.grid}
247
                     grid={this.state.grid}
247
                     backgroundColor={this.colors.tetrisBackground}
248
                     backgroundColor={this.colors.tetrisBackground}
248
                 />
249
                 />
256
                     />
257
                     />
257
                 </View>
258
                 </View>
258
                 <View style={{
259
                 <View style={{
260
+                    position: 'absolute',
261
+                    bottom: 0,
259
                     flexDirection: 'row',
262
                     flexDirection: 'row',
260
                     width: '100%',
263
                     width: '100%',
261
                 }}>
264
                 }}>
288
                         onPressIn={() => this.logic.downPressedIn(this.updateGridScore)}
291
                         onPressIn={() => this.logic.downPressedIn(this.updateGridScore)}
289
                         onPress={() => this.logic.pressedOut()}
292
                         onPress={() => this.logic.pressedOut()}
290
                         style={{marginLeft: 'auto'}}
293
                         style={{marginLeft: 'auto'}}
294
+                        color={this.colors.tetrisScore}
291
                     />
295
                     />
292
                 </View>
296
                 </View>
293
             </View>
297
             </View>

+ 1
- 0
screens/Tetris/components/Cell.js View File

27
                     backgroundColor: this.props.isEmpty ? 'transparent' : this.props.color,
27
                     backgroundColor: this.props.isEmpty ? 'transparent' : this.props.color,
28
                     borderColor: this.props.isEmpty ? 'transparent' : this.colors.tetrisBorder,
28
                     borderColor: this.props.isEmpty ? 'transparent' : this.colors.tetrisBorder,
29
                     borderStyle: 'solid',
29
                     borderStyle: 'solid',
30
+                    borderRadius: 2,
30
                     borderWidth: 1,
31
                     borderWidth: 1,
31
                     aspectRatio: 1,
32
                     aspectRatio: 1,
32
                 }}
33
                 }}

+ 5
- 3
screens/Tetris/components/Grid.js View File

11
     backgroundColor: string,
11
     backgroundColor: string,
12
     height: number,
12
     height: number,
13
     width: number,
13
     width: number,
14
-    containerHeight: number|string,
14
+    containerMaxHeight: number|string,
15
+    containerMaxWidth: number|string,
15
 }
16
 }
16
 
17
 
17
 class Grid extends React.Component<Props>{
18
 class Grid extends React.Component<Props>{
33
         return(
34
         return(
34
             <View style={{
35
             <View style={{
35
                 flexDirection: 'row',
36
                 flexDirection: 'row',
37
+                backgroundColor: this.props.backgroundColor,
36
             }}>
38
             }}>
37
                 {cells}
39
                 {cells}
38
             </View>
40
             </View>
51
         return (
53
         return (
52
             <View style={{
54
             <View style={{
53
                 flexDirection: 'column',
55
                 flexDirection: 'column',
54
-                height: this.props.containerHeight,
56
+                maxWidth: this.props.containerMaxWidth,
57
+                maxHeight: this.props.containerMaxHeight,
55
                 aspectRatio: this.props.width/this.props.height,
58
                 aspectRatio: this.props.width/this.props.height,
56
                 marginLeft: 'auto',
59
                 marginLeft: 'auto',
57
                 marginRight: 'auto',
60
                 marginRight: 'auto',
58
-                backgroundColor: this.props.backgroundColor,
59
             }}>
61
             }}>
60
                 {this.getGrid()}
62
                 {this.getGrid()}
61
             </View>
63
             </View>

+ 2
- 1
screens/Tetris/components/Preview.js View File

26
                     width={this.props.next[i][0].length}
26
                     width={this.props.next[i][0].length}
27
                     height={this.props.next[i].length}
27
                     height={this.props.next[i].length}
28
                     grid={this.props.next[i]}
28
                     grid={this.props.next[i]}
29
-                    containerHeight={50}
29
+                    containerMaxHeight={50}
30
+                    containerMaxWidth={50}
30
                     backgroundColor={'transparent'}
31
                     backgroundColor={'transparent'}
31
                 />
32
                 />
32
             );
33
             );

Loading…
Cancel
Save