summaryrefslogtreecommitdiff
path: root/client/src/lib/components/definition.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/definition.js
parentb694bd511ceccd00d4a4c98f36f910d5fc5f79c4 (diff)
react-native-web port of fmf app
Diffstat (limited to 'client/src/lib/components/definition.js')
-rw-r--r--client/src/lib/components/definition.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/client/src/lib/components/definition.js b/client/src/lib/components/definition.js
new file mode 100644
index 0000000..b6b78f5
--- /dev/null
+++ b/client/src/lib/components/definition.js
@@ -0,0 +1,52 @@
+import React, { Component } from 'react';
+import {
+ StyleSheet,
+ View,
+} from 'react-native';
+
+import ClearText from './text'
+
+export default class Definition extends Component {
+ render() {
+ let { labelStyle, contentStyle, label, children, contentIsView, ...others } = this.props
+ let content;
+ if (contentIsView) {
+ content = (
+ <View style={[styles.contentView, contentStyle]}>{children}</View>
+ )
+ }
+ else {
+ content = (
+ <ClearText style={[styles.content, contentStyle]}>{children}</ClearText>
+ )
+ }
+ return (
+ <View style={styles.item} {...others}>
+ <ClearText style={[styles.label, labelStyle]}>{label}</ClearText>
+ {content}
+ </View>
+ )
+ }
+}
+
+const styles = StyleSheet.create({
+ item: {
+ justifyContent: 'flex-start',
+ flexDirection: 'row',
+ width: '100%',
+ paddingBottom: 0,
+ },
+ label: {
+ width: 80,
+ minWidth: 80,
+ textAlign: 'left',
+ color: '#bbb',
+ },
+ content: {
+ flex: 1,
+ textAlign: 'left'
+ },
+ contentView: {
+ flex: 1,
+ },
+})