use Inter font for markdown display and some style tweaks

This commit is contained in:
Akinwale Ariwodola 2020-01-09 18:11:23 +01:00
parent 3395fa7aa2
commit 6c55633751
5 changed files with 45 additions and 24 deletions

View file

@ -51,7 +51,7 @@ export default class ChannelIconItem extends React.PureComponent {
<TouchableOpacity style={channelIconStyle.container} onPress={onPress}> <TouchableOpacity style={channelIconStyle.container} onPress={onPress}>
{isResolvingUri && ( {isResolvingUri && (
<View style={channelIconStyle.centered}> <View style={channelIconStyle.centered}>
<ActivityIndicator size={'small'} color={Colors.LbryGreen} /> <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
</View> </View>
)} )}
<View <View

View file

@ -191,7 +191,7 @@ export default class ChannelSelector extends React.PureComponent {
const channel = this.state.addingChannel ? 'new' : this.props.channel; const channel = this.state.addingChannel ? 'new' : this.props.channel;
const { balance, enabled, fetchingChannels, channels = [] } = this.props; const { balance, enabled, fetchingChannels, channels = [] } = this.props;
const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat( const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(
channels ? channels.map(ch => ch.name) : [] channels ? channels.map(ch => ch.name) : [],
); );
const { const {
@ -264,7 +264,7 @@ export default class ChannelSelector extends React.PureComponent {
</Text> </Text>
<View style={channelSelectorStyle.buttonContainer}> <View style={channelSelectorStyle.buttonContainer}>
{creatingChannel && <ActivityIndicator size={'small'} color={Colors.LbryGreen} />} {creatingChannel && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
{!creatingChannel && ( {!creatingChannel && (
<View style={channelSelectorStyle.buttons}> <View style={channelSelectorStyle.buttons}>
<Link style={channelSelectorStyle.cancelLink} text={__('Cancel')} onPress={this.handleCreateCancel} /> <Link style={channelSelectorStyle.cancelLink} text={__('Cancel')} onPress={this.handleCreateCancel} />

View file

@ -43,7 +43,7 @@ class SuggestedSubscriptionItem extends React.PureComponent {
if (isResolvingUri) { if (isResolvingUri) {
return ( return (
<View style={subscriptionsStyle.itemLoadingContainer}> <View style={subscriptionsStyle.itemLoadingContainer}>
<ActivityIndicator size={'small'} color={Colors.LbryGreen} /> <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
</View> </View>
); );
} }

View file

@ -9,6 +9,7 @@ import {
Image, Image,
Linking, Linking,
NativeModules, NativeModules,
Platform,
ScrollView, ScrollView,
StatusBar, StatusBar,
StyleSheet, StyleSheet,
@ -185,7 +186,7 @@ class FilePage extends React.PureComponent {
if (purchaseUriErrorMessage && purchaseUriErrorMessage.trim().length > 0) { if (purchaseUriErrorMessage && purchaseUriErrorMessage.trim().length > 0) {
notify({ message: purchaseUriErrorMessage, isError: true }); notify({ message: purchaseUriErrorMessage, isError: true });
} }
this.setState({ downloadPressed: false, fileViewLogged: false, mediaLoaded: false }); this.setState({ downloadPressed: false, fileViewLogged: false, mediaLoaded: false, showRecommended: true });
} }
const mediaType = Lbry.getMediaType(contentType); const mediaType = Lbry.getMediaType(contentType);
@ -261,7 +262,7 @@ class FilePage extends React.PureComponent {
this.setState({ autoGetAttempted: true }, () => this.checkStoragePermissionForDownload()); this.setState({ autoGetAttempted: true }, () => this.checkStoragePermissionForDownload());
} }
if (((costInfo && costInfo.cost > 0) || !isPlayable) && !this.state.showRecommended) { if (((costInfo && costInfo.cost > 0) || !isPlayable) && (!fileInfo && !isViewable) && !this.state.showRecommended) {
this.setState({ showRecommended: true }); this.setState({ showRecommended: true });
} }
@ -620,13 +621,13 @@ class FilePage extends React.PureComponent {
confirmPurchaseUri = (uri, costInfo, download) => { confirmPurchaseUri = (uri, costInfo, download) => {
const { notify, purchaseUri, title } = this.props; const { notify, purchaseUri, title } = this.props;
const { cost } = costInfo;
if (!costInfo) { if (!costInfo) {
notify({ message: __('This content cannot be viewed at this time. Please try again in a bit.'), isError: true }); notify({ message: __('This content cannot be viewed at this time. Please try again in a bit.'), isError: true });
this.fetchCostInfo(uri, this.props);
return; return;
} }
const { cost } = costInfo;
if (costInfo.cost > 0) { if (costInfo.cost > 0) {
Alert.alert( Alert.alert(
__('Confirm Purchase'), __('Confirm Purchase'),
@ -763,6 +764,7 @@ class FilePage extends React.PureComponent {
}, },
], ],
showImageViewer: true, showImageViewer: true,
showRecommended: true,
}, },
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW), () => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW),
); );
@ -774,6 +776,7 @@ class FilePage extends React.PureComponent {
this.setState( this.setState(
{ {
showWebView: true, showWebView: true,
showRecommended: true,
}, },
() => { () => {
pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW); pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW);
@ -815,21 +818,40 @@ class FilePage extends React.PureComponent {
const localFileUri = this.localUriForFileInfo(fileInfo); const localFileUri = this.localUriForFileInfo(fileInfo);
if (['text/markdown', 'text/md'].includes(contentType)) { if (['text/markdown', 'text/md'].includes(contentType)) {
const html = let fontdecl = '';
'<!doctype html>' + if (Platform.OS === 'android') {
'<html>' + fontdecl = `
' <head>' + @font-face {
' <meta charset="utf-8"/>' + font-family: 'Inter';
' <meta name="viewport" content="width=device-width, user-scalable=no"/>' + src: url('file:///android_asset/fonts/Inter-Regular.otf');
' <style type="text/css">' + font-weight: normal;
' body { margin: 16px }' + }
' img { width: 100%; }' + @font-face {
' </style>' + font-family: 'Inter;
' </head>' + src: url('file:///android_asset/fonts/Inter-Bold.otf');
' <body>' + font-weight: bold;
' <div id="content"></div>' + }
' </body>' + `;
'</html>'; }
const html = `
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, user-scalable=no"/>
<style type="text/css">
${fontdecl}
body { font-family: 'Inter', sans-serif; margin: 16px }
img { width: 100%; }
</style>
</head>
<body>
<div id="content"></div>
</body>
</html>
`;
return { html }; return { html };
} }

View file

@ -31,7 +31,6 @@ const uriBarStyle = StyleSheet.create({
paddingRight: 12, paddingRight: 12,
fontFamily: 'Inter-Regular', fontFamily: 'Inter-Regular',
fontSize: 16, fontSize: 16,
height: 44,
lineHeight: 18, lineHeight: 18,
flex: 17, flex: 17,
}, },