From 06e20cb460faa5c302511f6444c4017d5ebd07e0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 4 Jun 2017 18:19:08 -0400 Subject: more mobile hegemony --- client/src/lib/components/button.js | 10 ++++++-- client/src/lib/components/youtube.js | 2 +- client/src/lib/timeline/timelineEvent.js | 2 +- client/src/lib/timeline/timelineFull.js | 43 ++++++++++++++++++++++++++------ client/src/lib/views/contact.js | 20 ++++++++------- client/src/lib/views/livestream.js | 6 ++--- 6 files changed, 60 insertions(+), 23 deletions(-) (limited to 'client/src') diff --git a/client/src/lib/components/button.js b/client/src/lib/components/button.js index ca8388b..edd75de 100644 --- a/client/src/lib/components/button.js +++ b/client/src/lib/components/button.js @@ -30,6 +30,12 @@ export default class Button extends Component { } } +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({ text: { color: '#000', @@ -38,8 +44,8 @@ const styles = StyleSheet.create({ padding: 0, }, button: { - padding: 10, - margin: 10, + padding: isMobile ? 5 : 10, + margin: isMobile ? 5 : 10, borderRadius: 3, backgroundColor: '#fff', borderBottomColor: '#bbb', diff --git a/client/src/lib/components/youtube.js b/client/src/lib/components/youtube.js index a9ea740..75349e4 100644 --- a/client/src/lib/components/youtube.js +++ b/client/src/lib/components/youtube.js @@ -25,7 +25,7 @@ export default class Youtube extends Component { this.player = new YT.Player(this.container, { videoId: this.props.ytid, width: "100%", - height: isMobile ? 100 : 400, + height: isMobile ? 1 : 400, playerVars: { 'autohide': 1, 'autoplay': 0, diff --git a/client/src/lib/timeline/timelineEvent.js b/client/src/lib/timeline/timelineEvent.js index d8165fa..84e9437 100644 --- a/client/src/lib/timeline/timelineEvent.js +++ b/client/src/lib/timeline/timelineEvent.js @@ -35,7 +35,7 @@ export default class TimelineEvent extends Component { height = originalHeight * imageWidth / originalWidth } if (isNaN(width) || isNaN(height)) { - console.log(width, height, item.image.uri) + console.log(width, height, item.image.uri) } image = 450 ? 450 : originalHeight - const width = originalWidth * height / originalHeight + let height = originalHeight > imageHeight ? imageHeight : originalHeight + let width = originalWidth * height / originalHeight + console.warn(width, imageWidth) + if (width > imageWidth) { + width = imageWidth + height = originalHeight * imageWidth / originalWidth + } + image = ( @@ -88,17 +103,17 @@ export default class TimelineFull extends Component { return ( {image} {item.title} - + - + {item.date} {item.medium} @@ -119,7 +134,6 @@ export default class TimelineFull extends Component { } } - function linkTextFromUrl (url) { const url_parts = url.split('/') const domain = url_parts[2] @@ -135,6 +149,21 @@ function capitalize (s){ return s.charAt(0).toUpperCase() + s.slice(1) } +const mobileStyles = StyleSheet.create({ + item: { + maxWidth: 400, + maxHeight: 250, + padding: 40, + paddingTop: 50, + }, + bodyContainer: { + width: '100%', + }, + metadataContainer: { + width: '100%', + }, +}) + const styles = StyleSheet.create({ container: { flex: 1, @@ -148,7 +177,7 @@ const styles = StyleSheet.create({ backgroundColor: 'black', }, item: { - maxWidth: 1000, + maxWidth: isMobile ? 400 : 1000, padding: 40, }, imageContainer: { diff --git a/client/src/lib/views/contact.js b/client/src/lib/views/contact.js index 19bec89..57d3e9d 100644 --- a/client/src/lib/views/contact.js +++ b/client/src/lib/views/contact.js @@ -95,20 +95,22 @@ export default class Contact extends Component { } render() { return ( - - - - {this.props.content.body} - + + + + + {this.props.content.body} + - {this.renderForm()} - {this.renderComments()} - + {this.renderForm()} + {this.renderComments()} + + {this.renderActivity()} - + ) } renderForm() { diff --git a/client/src/lib/views/livestream.js b/client/src/lib/views/livestream.js index 88c66cf..5df52aa 100644 --- a/client/src/lib/views/livestream.js +++ b/client/src/lib/views/livestream.js @@ -13,7 +13,7 @@ export default class Livestream extends Component { constructor(props) { super() this.state = { - ytid: getYTID(choice(props.content.streams).uri), + ytid: isMobile ? "" : getYTID(choice(props.content.streams).uri), isReady: false, currentTime: 0, duration: 0, @@ -105,13 +105,13 @@ const styles = StyleSheet.create({ }, videoContainer: { justifyContent: 'flex-start', - height: isMobile ? 100 : 400, + height: isMobile ? 0 : 400, width: '100%', padding: 10, }, video: { alignSelf: 'stretch', - height: isMobile ? 100 : 400, + height: isMobile ? 0 : 400, width: '100%', backgroundColor: 'black', marginVertical: 10 -- cgit v1.2.3-70-g09d2