Collapse description (#490)

* collapse file description by default and add display toggle
This commit is contained in:
Akinwale Ariwodola 2019-03-26 15:10:07 +01:00 committed by GitHub
parent f30f1f47d5
commit 53fb072373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 18 deletions

View file

@ -2,10 +2,11 @@
import React from 'react'; import React from 'react';
import { ActivityIndicator, Text, TouchableOpacity, View } from 'react-native'; import { ActivityIndicator, Text, TouchableOpacity, View } from 'react-native';
import { formatCredits } from 'lbry-redux' import { formatCredits } from 'lbry-redux'
import Address from '../address'; import Address from 'component/address';
import Button from '../button'; import Button from 'component/button';
import Colors from '../../styles/colors'; import Colors from 'styles/colors';
import floatingButtonStyle from '../../styles/floatingButton'; import Icon from 'react-native-vector-icons/FontAwesome5';
import floatingButtonStyle from 'styles/floatingButton';
type Props = { type Props = {
balance: number, balance: number,
@ -27,7 +28,8 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
{unclaimedRewardAmount > 0 && {unclaimedRewardAmount > 0 &&
<TouchableOpacity style={floatingButtonStyle.pendingContainer} <TouchableOpacity style={floatingButtonStyle.pendingContainer}
onPress={() => navigation && navigation.navigate({ routeName: 'Rewards' })} > onPress={() => navigation && navigation.navigate({ routeName: 'Rewards' })} >
<Text style={floatingButtonStyle.text}>claim {unclaimedRewardAmount}</Text> <Icon name="award" size={18} style={floatingButtonStyle.rewardIcon} />
<Text style={floatingButtonStyle.text}>{unclaimedRewardAmount}</Text>
</TouchableOpacity>} </TouchableOpacity>}
</View> </View>
); );

View file

@ -16,6 +16,7 @@ import {
WebView WebView
} from 'react-native'; } from 'react-native';
import { navigateToUri } from 'utils/helper'; import { navigateToUri } from 'utils/helper';
import Icon from 'react-native-vector-icons/FontAwesome5';
import ImageViewer from 'react-native-image-zoom-viewer'; import ImageViewer from 'react-native-image-zoom-viewer';
import Button from 'component/button'; import Button from 'component/button';
import Colors from 'styles/colors'; import Colors from 'styles/colors';
@ -62,6 +63,7 @@ class FilePage extends React.PureComponent {
mediaLoaded: false, mediaLoaded: false,
pageSuspended: false, pageSuspended: false,
relatedContentY: 0, relatedContentY: 0,
showDescription: false,
showImageViewer: false, showImageViewer: false,
showWebView: false, showWebView: false,
showTipView: false, showTipView: false,
@ -540,15 +542,8 @@ class FilePage extends React.PureComponent {
position={position} position={position}
/>} />}
{showActions && {(showActions && showFileActions) &&
<View style={filePageStyle.actions}> <View style={filePageStyle.actions}>
<View style={filePageStyle.socialActions}>
<Button style={filePageStyle.actionButton}
theme={"light"}
icon={"gift"}
text={"Send a tip"}
onPress={() => this.setState({ showTipView: true })} />
</View>
{showFileActions && {showFileActions &&
<View style={filePageStyle.fileActions}> <View style={filePageStyle.fileActions}>
{completed && <Button style={filePageStyle.actionButton} {completed && <Button style={filePageStyle.actionButton}
@ -598,13 +593,17 @@ class FilePage extends React.PureComponent {
style={[filePageStyle.actionButton, filePageStyle.bellButton]} style={[filePageStyle.actionButton, filePageStyle.bellButton]}
uri={fullChannelUri} uri={fullChannelUri}
name={channelName} /> name={channelName} />
<TouchableOpacity style={filePageStyle.descriptionToggle}
onPress={() => this.setState({ showDescription: !this.state.showDescription })}>
<Icon name={this.state.showDescription ? "caret-up" : "caret-down"} size={24} />
</TouchableOpacity>
</View> </View>
</View> </View>
} }
{description && description.length > 0 && <View style={filePageStyle.divider} />} {(this.state.showDescription && description && description.length > 0) && <View style={filePageStyle.divider} />}
{(this.state.showDescription && description) &&
{description && <Text style={filePageStyle.description} selectable={true}>{this.linkify(description)}</Text>} <Text style={filePageStyle.description} selectable={true}>{this.linkify(description)}</Text>}
<View onLayout={this.setRelatedContentPosition} /> <View onLayout={this.setRelatedContentPosition} />
<RelatedContent navigation={navigation} uri={uri} /> <RelatedContent navigation={navigation} uri={uri} />

View file

@ -53,7 +53,7 @@ const filePageStyle = StyleSheet.create({
}, },
title: { title: {
fontFamily: 'Inter-UI-Bold', fontFamily: 'Inter-UI-Bold',
fontSize: 24, fontSize: 20,
marginTop: 12, marginTop: 12,
marginLeft: 20, marginLeft: 20,
marginRight: 20, marginRight: 20,
@ -76,7 +76,7 @@ const filePageStyle = StyleSheet.create({
}, },
channelName: { channelName: {
fontFamily: 'Inter-UI-SemiBold', fontFamily: 'Inter-UI-SemiBold',
fontSize: 20, fontSize: 16,
color: Colors.LbryGreen color: Colors.LbryGreen
}, },
publishDateText: { publishDateText: {
@ -282,6 +282,12 @@ const filePageStyle = StyleSheet.create({
alignSelf: 'flex-start', alignSelf: 'flex-start',
marginTop: 17 marginTop: 17
}, },
descriptionToggle: {
alignItems: 'center',
justifyContent: 'center',
width: 36,
height: 36
},
text: { text: {
fontFamily: 'Inter-UI-Regular', fontFamily: 'Inter-UI-Regular',
fontSize: 16, fontSize: 16,

View file

@ -36,6 +36,7 @@ const floatingButtonStyle = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
backgroundColor: Colors.BrighterLbryGreen, backgroundColor: Colors.BrighterLbryGreen,
flexDirection: 'row',
elevation: 3 elevation: 3
}, },
text: { text: {
@ -46,6 +47,10 @@ const floatingButtonStyle = StyleSheet.create({
bottomRight: { bottomRight: {
right: 10, right: 10,
bottom: 10 bottom: 10
},
rewardIcon: {
color: Colors.White,
marginRight: 4
} }
}); });