summaryrefslogtreecommitdiff
path: root/client/src/lib/components/definition.js
diff options
context:
space:
mode:
authorjules <jules@carbonpictures.com>2017-06-02 15:42:34 +0000
committerjules <jules@carbonpictures.com>2017-06-02 15:42:34 +0000
commit5f26431f03228a85273e7f7d51abd6098ea9f2a5 (patch)
tree6a709972cbb0babd68aaa10fe277b2c843fd7451 /client/src/lib/components/definition.js
parent291fe3eedd9a460fc44d2ea3ea81c7d79f2dfbcf (diff)
parentdd70fa81a205304cb48bbc0494ad34c16d496ff2 (diff)
merge
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,
+ },
+})