summaryrefslogtreecommitdiff
path: root/client/src/lib/components/container.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-06-01 19:47:08 -0400
committerJules Laplace <julescarbon@gmail.com>2017-06-01 19:47:08 -0400
commit3e72bfa56c860826429a842f6c128d78d4a930db (patch)
tree3cecd31c92d53fae32e9761b80802c82f3dcb7fa /client/src/lib/components/container.js
parentb694bd511ceccd00d4a4c98f36f910d5fc5f79c4 (diff)
react-native-web port of fmf app
Diffstat (limited to 'client/src/lib/components/container.js')
-rw-r--r--client/src/lib/components/container.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/client/src/lib/components/container.js b/client/src/lib/components/container.js
new file mode 100644
index 0000000..fe6fd5e
--- /dev/null
+++ b/client/src/lib/components/container.js
@@ -0,0 +1,50 @@
+import React, { Component } from 'react';
+import {
+ StyleSheet,
+ View
+} from 'react-native';
+
+import Heading from '../components/heading'
+
+export default class Container extends Component {
+ constructor() {
+ super()
+ }
+ render() {
+ const { heading, style, bodyStyle, headingOnPress, ...props } = this.props
+ let headingEl;
+ if (heading) {
+ headingEl = (
+ <Heading style={styles.heading} onPress={headingOnPress}>
+ {heading.toUpperCase()}
+ </Heading>
+ )
+ }
+ else {
+ headingEl = null
+ }
+ return (
+ <View style={[styles.container, style]} {...props}>
+ {headingEl}
+ <View style={[styles.body, bodyStyle]}>
+ {this.props.children}
+ </View>
+ </View>
+ )
+ }
+}
+
+const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ justifyContent: 'flex-start',
+ },
+ heading: {
+ },
+ body: {
+ flex: 1,
+ justifyContent: 'flex-start',
+ alignItems: 'flex-start',
+ paddingLeft: 10,
+ }
+})