From 3e72bfa56c860826429a842f6c128d78d4a930db Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 1 Jun 2017 19:47:08 -0400 Subject: react-native-web port of fmf app --- client/src/lib/components/button.js | 55 +++++ client/src/lib/components/checkbox.js | 35 +++ client/src/lib/components/close.js | 33 +++ client/src/lib/components/container.js | 50 ++++ client/src/lib/components/definition.js | 52 ++++ client/src/lib/components/footer.js | 77 ++++++ client/src/lib/components/header.js | 52 ++++ client/src/lib/components/heading.js | 34 +++ client/src/lib/components/htmlStyles.js | 32 +++ client/src/lib/components/mapStyle.js | 287 +++++++++++++++++++++++ client/src/lib/components/modal.js | 41 ++++ client/src/lib/components/pushNotifications.js | 38 +++ client/src/lib/components/scrollableContainer.js | 51 ++++ client/src/lib/components/text.js | 30 +++ client/src/lib/components/webViewModal.js | 56 +++++ client/src/lib/components/youtube.js | 91 +++++++ 16 files changed, 1014 insertions(+) create mode 100644 client/src/lib/components/button.js create mode 100644 client/src/lib/components/checkbox.js create mode 100644 client/src/lib/components/close.js create mode 100644 client/src/lib/components/container.js create mode 100644 client/src/lib/components/definition.js create mode 100644 client/src/lib/components/footer.js create mode 100644 client/src/lib/components/header.js create mode 100644 client/src/lib/components/heading.js create mode 100644 client/src/lib/components/htmlStyles.js create mode 100644 client/src/lib/components/mapStyle.js create mode 100644 client/src/lib/components/modal.js create mode 100644 client/src/lib/components/pushNotifications.js create mode 100644 client/src/lib/components/scrollableContainer.js create mode 100644 client/src/lib/components/text.js create mode 100644 client/src/lib/components/webViewModal.js create mode 100644 client/src/lib/components/youtube.js (limited to 'client/src/lib/components') diff --git a/client/src/lib/components/button.js b/client/src/lib/components/button.js new file mode 100644 index 0000000..a5cf8ea --- /dev/null +++ b/client/src/lib/components/button.js @@ -0,0 +1,55 @@ +import React, { Component } from 'react'; +import { + StyleSheet, + Text, + TouchableOpacity, + View +} from 'react-native'; +import DeviceInfo from 'react-native-device-info' + +export default class Button extends Component { + render() { + let { buttonStyle, textStyle, ...others } = this.props + let activeOpacity = 0.5 + let viewElementStyle = [ styles.button, buttonStyle ] + let textElementStyle = [ styles.text, textStyle ] + if (this.props.disabled) { + viewElementStyle.push( styles.disabledButton ) + textElementStyle.push( styles.disabledText ) + activeOpacity = 1.0 + } + return ( + { if (! this.props.disabled) { this.props.onPress() }}}> + + + {this.props.label} + + + + ) + } +} + +const styles = StyleSheet.create({ + text: { + color: '#000', + fontFamily: 'Futura-Medium', + textAlign: 'center', + padding: 0, + }, + button: { + padding: 10, + margin: 10, + borderRadius: 3, + backgroundColor: '#fff', + borderBottomColor: '#bbb', + borderBottomWidth: 2, + }, + disabledButton: { + backgroundColor: '#bbb', + borderBottomColor: '#888', + }, + disabledText: { + color: '#333', + }, +}) diff --git a/client/src/lib/components/checkbox.js b/client/src/lib/components/checkbox.js new file mode 100644 index 0000000..ea4ab7e --- /dev/null +++ b/client/src/lib/components/checkbox.js @@ -0,0 +1,35 @@ +import React, { Component } from 'react' +import { + View, + Image, + StyleSheet, +} from 'react-native' + +import ClearText from './text' + +export default class CheckBox extends Component { + render() { + const image = this.props.checked ? ( + + ) : ( + + ) + return ( + this.props.onChange(this.props.checked)}> + {image} + {this.props.label} + + ) + } +} + +const styles = StyleSheet.create({ + row: { + flexDirection: 'row', + }, + image: { + width: 30, + height: 30, + marginRight: 5, + } +}) diff --git a/client/src/lib/components/close.js b/client/src/lib/components/close.js new file mode 100644 index 0000000..12b4a0a --- /dev/null +++ b/client/src/lib/components/close.js @@ -0,0 +1,33 @@ +import React, { Component } from 'react'; +import { + StyleSheet, + TouchableOpacity, + Image +} from 'react-native'; +import DeviceInfo from 'react-native-device-info' + +export default class Close extends Component { + render() { + return ( + + + + ) + } +} + +const styles = StyleSheet.create({ + close: { + position: 'absolute', + top: 10, + right: 10, + width: 40, + height: 40, + padding: 5, + backgroundColor: 'black' + }, + closeImage: { + width: 30, + height: 30, + }, +}) 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.toUpperCase()} + + ) + } + else { + headingEl = null + } + return ( + + {headingEl} + + {this.props.children} + + + ) + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'flex-start', + }, + heading: { + }, + body: { + flex: 1, + justifyContent: 'flex-start', + alignItems: 'flex-start', + paddingLeft: 10, + } +}) 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 = ( + {children} + ) + } + else { + content = ( + {children} + ) + } + return ( + + {label} + {content} + + ) + } +} + +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, + }, +}) diff --git a/client/src/lib/components/footer.js b/client/src/lib/components/footer.js new file mode 100644 index 0000000..b389245 --- /dev/null +++ b/client/src/lib/components/footer.js @@ -0,0 +1,77 @@ +import React, { Component } from 'react' +import { + Image, + StyleSheet, + TouchableOpacity, + Text, + View, +} from 'react-native' +import { Link } from 'react-router-dom' + +export default class ClearText extends Component { + render() { + return ( + + + + Privacy + + + + this.props.onLinkPress('http://armoryonpark.org/')}> + + + + + + Credits + + + + ) + } +} + +const isIphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) +const isIpad = (navigator.userAgent.match(/iPad/i)) +const isAndroid = (navigator.userAgent.match(/Android/i)) +const isMobile = isIphone || isIpad || isAndroid +const isDesktop = ! isMobile + +const styles = StyleSheet.create({ + footer: { + position: 'fixed', + bottom: 0, + left: 0, + width: '100%', + height: isMobile ? 40 : 70, + backgroundColor: 'black', + paddingTop: isMobile ? 5 : 20, + paddingBottom: isMobile ? 5 : 20, + flexDirection: 'row', + justifyContent: 'space-around', + alignItems: 'center', + }, + footerLogo: { + flexDirection: 'row', + justifyContent: 'center', + alignItems: 'center', + maxWidth: 140, + maxHeight: 40, + width: 260, + height: 39, + }, + footerItem: { + height: 35, + flex: 1, + alignItems: 'center', + }, + footerText: { + fontFamily: 'Futura-Medium', + color: 'white', + fontSize: 10, + flex: 1, + padding: 10, + marginTop: 4, + } +}) diff --git a/client/src/lib/components/header.js b/client/src/lib/components/header.js new file mode 100644 index 0000000..4cd264a --- /dev/null +++ b/client/src/lib/components/header.js @@ -0,0 +1,52 @@ +import React, { Component } from 'react' +import { + Image, + StyleSheet, + TouchableOpacity, + Text, + View, +} from 'react-native' +import { Link } from 'react-router-dom' + +import Nav from '../views/nav' + +export default class ClearText extends Component { + render() { + return ( + +