diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-06-04 15:55:37 -0400 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-06-04 15:55:37 -0400 |
| commit | 14b8f0acb52cfe6eca4d74a583562939d3aa7a1a (patch) | |
| tree | 97cc04a3237659c6087225a581b5781803c18024 /client/src/lib/views/information.js | |
| parent | 4aeaefd41b48a042ae2a1d03ca9a7d77608c8069 (diff) | |
safari timeline
Diffstat (limited to 'client/src/lib/views/information.js')
| -rw-r--r-- | client/src/lib/views/information.js | 233 |
1 files changed, 180 insertions, 53 deletions
diff --git a/client/src/lib/views/information.js b/client/src/lib/views/information.js index 77d1af2..9dc5ced 100644 --- a/client/src/lib/views/information.js +++ b/client/src/lib/views/information.js @@ -1,42 +1,206 @@ import React, { Component } from 'react'; import { StyleSheet, + View, Image, + TouchableOpacity, + ScrollView, } from 'react-native'; +import HTMLView from 'react-native-htmlview' +import Modal from 'react-native-modal' + +import htmlStyles from '../components/htmlStyles' + import ScrollableContainer from '../components/scrollableContainer' import ClearText from '../components/text' +import Button from '../components/button' +import Close from '../components/close' +import Heading from '../components/heading' export default class Information extends Component { constructor(props) { super() + this.state = { + essay: { title: '', byline: '', body: '' }, + essayModalVisible: false, + biosVisible: false, + } + } + showEssay(essay) { + let essayBody = essay.body.split('\n').map( (s) => { + s = s.replace(/\r/g,'').trim() + if (! s.length) return '' + if (s.match(/^<h2>/i)) return s.toUpperCase() + return '<p>' + s + '</p>' + }).join('') + if (essay.id == 'notes-on-surveillance') { + essayBody += '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' + } + else { + essayBody += '\n\n\n\n\n' + } + this.setState({ essay, essayBody, essayModalVisible: true }) + } + hideEssay() { + this.setState({ essayModalVisible: false }) + } + showBios() { + this.setState({ biosVisible: true }) + } + hideBios() { + this.setState({ biosVisible: false }) } render() { const content = this.props.content + const essays = this.props.essays.map( (essay, i) => { + return ( + <TouchableOpacity key={i} onPress={() => this.showEssay(essay)}> + <View style={styles.essayContainer}> + <ClearText style={styles.essayTitle}>{essay.title}</ClearText> + <ClearText style={styles.essayByline}>{essay.byline}</ClearText> + </View> + </TouchableOpacity> + ) + }) return ( <ScrollableContainer heading="ABOUT THIS WORK" bodyStyle={styles.bodyStyle}> - <ClearText style={styles.body}> - {this.props.content.show} - </ClearText> + <View style={styles.essays}> + {essays} - <Image source={require('../../img/aiweiwei.png')} resizeMode='cover' style={styles.face} /> - <ClearText style={styles.body}> - {this.props.content.aiWeiWeiBio} - </ClearText> - <Image source={require('../../img/herzogDeMeuron.png')} resizeMode='cover' style={styles.face} /> - <ClearText style={styles.body}> - {this.props.content.herzogBio} - </ClearText> - <ClearText style={styles.body}> - {this.props.content.deMeuronBio} - </ClearText> - <ClearText style={styles.footer}> - </ClearText> + <TouchableOpacity onPress={() => this.showBios()}> + <View style={styles.essayContainer}> + <ClearText style={styles.essayTitle}>Artist Biographies</ClearText> + <ClearText style={styles.essayByline}>Ai Weiwei, Jacques Herzog, Phillipe de Meuron</ClearText> + </View> + </TouchableOpacity> + </View> + + <Modal style={styles.modal} isVisible={this.state.biosVisible}> + <ScrollView contentContainerStyle={styles.modalContainer}> + <View style={styles.modalBody}> + + <Image source={require('../../img/aiweiwei.png')} resizeMode='cover' style={styles.face} /> + <ClearText style={styles.bio}> + {this.props.content.aiWeiWeiBio} + </ClearText> + <Image source={require('../../img/herzogDeMeuron.png')} resizeMode='cover' style={styles.face} /> + <ClearText style={styles.bio}> + {this.props.content.herzogBio} + </ClearText> + <ClearText style={styles.bio}> + {this.props.content.deMeuronBio} + </ClearText> + <ClearText style={styles.footer}> + </ClearText> + + </View> + </ScrollView> + <Close onPress={() => this.hideBios()} /> + </Modal> + + <Modal style={styles.modal} isVisible={this.state.essayModalVisible}> + <ScrollView contentContainerStyle={styles.modalContainer}> + <View style={styles.modalBody}> + <Heading style={styles.essayHeader}>{this.state.essay.title.toUpperCase()}</Heading> + <Heading style={styles.essayBylineHeader}>{this.state.essay.byline}</Heading> + <HTMLView value={this.state.essayBody} stylesheet={htmlStyles} onLinkPress={this.props.onLinkPress} /> + </View> + </ScrollView> + <Close onPress={() => this.hideEssay()} /> + </Modal> </ScrollableContainer> ); } } +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'flex-start', + alignItems: 'flex-start', + }, + bodyStyle: { + marginRight: 10, + }, + video: { + alignSelf: 'stretch', + height: 400, + width: '100%', + backgroundColor: 'black', + marginVertical: 10 + }, + body: { + textAlign: 'left', + paddingRight: 10, + width: '90%', + marginBottom: 20, + }, + + + bio: { + textAlign: 'left', + paddingRight: 10, + marginBottom: 20, + }, + face: { + width: 550, + height: 350, + marginBottom: 20, + }, + footer: { + marginBottom: 80, + }, + + essays: { + marginLeft: -55, + marginBottom: 20, + }, + essayContainer: { + padding: 10, + margin: 5, + }, + essayTitle: { + textDecorationColor: '#bbb', + textDecorationLine: 'underline', + }, + essayByline: { + fontSize: 12, + fontWeight: 'bold', + }, + essayHeader: { + paddingBottom: 0, + marginBottom: 0, + }, + essayBylineHeader: { + fontSize: 16, + fontWeight: 'bold', + marginBottom: 0, + }, + + modal: { + justifyContent: 'flex-start', + alignItems: 'center', + backgroundColor: 'rgb(0,0,0)', + margin: 0, + padding: 0, + }, + modalContainer: { + justifyContent: 'flex-start', + alignItems: 'center', + }, + modalBody: { + marginTop: 20, + width: '90%', + backgroundColor: 'black', + padding: 40, + marginBottom: 200, + }, + +}) + + + /* <YouTube ref={(ref) => this.youtubePlayer = ref} @@ -75,40 +239,3 @@ export default class Information extends Component { style={styles.video} /> */ - -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'flex-start', - alignItems: 'flex-start', - }, - bodyStyle: { - marginRight: 10, - }, - video: { - alignSelf: 'stretch', - height: 400, - width: '100%', - backgroundColor: 'black', - marginVertical: 10 - }, - body: { - textAlign: 'left', - paddingRight: 10, - width: '90%', - marginBottom: 20, - maxWidth: 600, - }, - hero: { - width: '90%', - height: 300, - }, - face: { - width: '90vw', - height: 450, - marginBottom: 20, - }, - footer: { - marginBottom: 80, - }, -}) |
