From a18d0e4dc12b632a0feb507ed8bc3fb478670c47 Mon Sep 17 00:00:00 2001 From: Sonia Date: Wed, 20 Sep 2017 15:15:22 -0700 Subject: [PATCH] Conditionally render social media icons --- js/scenes/Event/Event.js | 15 +++--------- js/scenes/Login/styles.js | 2 +- js/scenes/Speaker/Speaker.js | 3 +-- js/scenes/Speaker/SpeakerComponents.js | 34 ++++++++++++++++++++++---- js/scenes/Speaker/cStyles.js | 2 +- 5 files changed, 36 insertions(+), 20 deletions(-) diff --git a/js/scenes/Event/Event.js b/js/scenes/Event/Event.js index fd5ccaf..ee62f91 100644 --- a/js/scenes/Event/Event.js +++ b/js/scenes/Event/Event.js @@ -4,26 +4,19 @@ import { Text, Image, TouchableOpacity, - ScrollView, - Dimensions + ScrollView } from 'react-native'; import PropTypes from 'prop-types'; import Moment from 'moment'; -import LinearGradient from 'react-native-linear-gradient'; +import GradientWrapper from '../../components/GradientWrapper'; import { goToSpeaker } from '../../navigation/navHelpers'; import OutlinedButton from '../../components/OutlinedButton/'; import { styles } from './styles'; -import { colors } from '../../config/styles'; const SingleEvent = ({ eventData, eventDataSet, attendEvent }) => { return ( - + Speakers {Moment.unix(eventData.startTime).format('h:mmA')} to {Moment.unix(eventData.endTime).format('h:mmA')} @@ -50,7 +43,7 @@ const SingleEvent = ({ eventData, eventDataSet, attendEvent }) => { onPress={() => attendEvent()} /> - + ); } diff --git a/js/scenes/Login/styles.js b/js/scenes/Login/styles.js index f88c908..2478ff6 100644 --- a/js/scenes/Login/styles.js +++ b/js/scenes/Login/styles.js @@ -34,7 +34,7 @@ export const styles = StyleSheet.create({ fontFamily: typography.titleHeading, fontSize: typography.norwester27, marginTop: 35, - width: '60%', + width: '50%', textAlign: 'center', }, subTitle: { diff --git a/js/scenes/Speaker/Speaker.js b/js/scenes/Speaker/Speaker.js index b895291..f4c1e4f 100644 --- a/js/scenes/Speaker/Speaker.js +++ b/js/scenes/Speaker/Speaker.js @@ -14,7 +14,6 @@ import { WarningModal, EventModal } from './SpeakerComponents'; -// import SpeakerAvatar from '../../components/SpeakerAvatar'; const Speaker = ({ speakerData, @@ -35,7 +34,7 @@ const Speaker = ({ diff --git a/js/scenes/Speaker/SpeakerComponents.js b/js/scenes/Speaker/SpeakerComponents.js index f4db6dc..4e61a1e 100644 --- a/js/scenes/Speaker/SpeakerComponents.js +++ b/js/scenes/Speaker/SpeakerComponents.js @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text, ScrollView } from 'react-native' +import { View, Text, ScrollView, Linking } from 'react-native' import Modal from 'react-native-modal'; import Icon from 'react-native-vector-icons/Ionicons'; import { cStyles } from './cStyles'; @@ -57,10 +57,34 @@ export const SpeakerContent = ({ speakerData, styles }) => ( {speakerData.speaker_id.fullName.toUpperCase()} {speakerData.speaker_id.bio} - - - - + {(speakerData.speaker_id.email) && + Linking.openURL(`mailto:${speakerData.speaker_id.email}`)} + style={cStyles.speakerIcons} + name='ios-mail' + /> + } + {(speakerData.speaker_id.socialMediaUrls.linkedIn.length > 0) && + Linking.openURL(`${speakerData.speaker_id.socialMediaUrls.linkedIn}`)} + style={cStyles.speakerIcons} + name='logo-linkedin' + /> + } + {(speakerData.speaker_id.socialMediaUrls.facebook.length > 0) && + Linking.openURL(`${speakerData.speaker_id.socialMediaUrls.facebook}`)} + style={cStyles.speakerIcons} + name='logo-facebook' + /> + } + {(speakerData.speaker_id.socialMediaUrls.twitter.length > 0) && + Linking.openURL(`${speakerData.speaker_id.socialMediaUrls.twitter}`)} + style={cStyles.speakerIcons} + name='logo-twitter' + /> + } ) diff --git a/js/scenes/Speaker/cStyles.js b/js/scenes/Speaker/cStyles.js index fcfc271..691227f 100644 --- a/js/scenes/Speaker/cStyles.js +++ b/js/scenes/Speaker/cStyles.js @@ -40,7 +40,7 @@ export const cStyles = StyleSheet.create({ socialMedia: { flex: 1, flexDirection: 'row', - justifyContent: 'space-around', + justifyContent: 'space-between', paddingRight: 50, }, speakerName: {