Skip to content

Commit cbaa4e5

Browse files
committed
Do a bunch of rejiggering on normalized text sizes and box sizes and thumbnail video sizes to make things look better on both 4s and ipads.
1 parent 51fdc53 commit cbaa4e5

3 files changed

Lines changed: 29 additions & 15 deletions

File tree

js/containers/generateNavigator.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import type {
3030
NavigationSceneRendererProps,
3131
NavigationState,
3232
} from 'NavigationTypeDefinition';
33+
import {
34+
semiNormalize,
35+
} from '../ui/normalize';
3336

3437
const {
3538
CardStack: NavigationCardStack,
@@ -88,7 +91,7 @@ class _AppContainer extends React.Component {
8891
if (props.scene.route.message) {
8992
title = this.props.intl.formatMessage(props.scene.route.message);
9093
}
91-
return <NavigationHeaderTitle textStyle={{color: 'white', fontSize: 24}}>
94+
return <NavigationHeaderTitle>
9295
{title}
9396
</NavigationHeaderTitle>;
9497
}
@@ -185,12 +188,11 @@ const styles = StyleSheet.create({
185188
alignItems: 'center',
186189
marginHorizontal: 16
187190
},
188-
189191
titleText: {
190192
flex: 1,
191-
fontSize: 18,
193+
fontSize: semiNormalize(18),
192194
fontWeight: '500',
193-
color: 'rgba(0, 0, 0, .9)',
195+
color: 'white',
194196
textAlign: Platform.OS === 'ios' ? 'center' : 'left'
195197
}
196198

js/learn/playlistViews.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,18 @@ const messages = defineMessages({
113113
},
114114
});
115115

116-
const boxWidth = semiNormalize(150);
116+
// Try to make our boxes as wide as we can...
117+
let boxWidth = normalize(170);
118+
// ...and only start scaling them non-proportionally on the larger screen sizes,
119+
// so that we do 3-4 columns
120+
if (Dimensions.get('window').width >= 1024) {
121+
boxWidth = semiNormalize(170);
122+
}
117123
const boxMargin = 5;
118124

119125
function listViewWidth() {
120126
const fullBox = boxWidth + boxMargin;
121-
return Math.floor(Dimensions.get('window').width / fullBox) * fullBox - 20;
127+
return Math.floor(Dimensions.get('window').width / fullBox) * fullBox - 10;
122128
}
123129

124130
function sortedTutorials(tutorials, language) {
@@ -166,7 +172,6 @@ class _PlaylistStylesView extends React.Component {
166172
const durationSeconds = style.tutorials.reduce((prev, current) => prev + current.getDurationSeconds(), 0);
167173
const length = formatDuration(this.props.intl.formatMessage, durationSeconds);
168174
let styleTitle = style.title;
169-
console.log(style.title, style.titleMessage);
170175
if (style.titleMessage) {
171176
styleTitle = this.props.intl.formatMessage(style.titleMessage);
172177
}
@@ -187,9 +192,9 @@ class _PlaylistStylesView extends React.Component {
187192
alignItems: 'center',
188193
}}>
189194
<Image source={style.thumbnail} resizeMode="contain" style={{width: imageWidth, height: imageWidth}}/>
190-
<Text style={{fontWeight: 'bold'}}>{styleTitle}</Text>
191-
<Text>{this.props.intl.formatMessage(messages.numTutorials, {count: style.tutorials.length})}</Text>
192-
<Text>{this.props.intl.formatMessage(messages.totalTime, {time: length})}</Text>
195+
<Text style={[styles.boxTitle, styles.boxText]}>{styleTitle}</Text>
196+
<Text style={styles.boxText}>{this.props.intl.formatMessage(messages.numTutorials, {count: style.tutorials.length})}</Text>
197+
<Text style={styles.boxText}>{this.props.intl.formatMessage(messages.totalTime, {time: length})}</Text>
193198
</View>
194199
</TouchableHighlight>;
195200
}
@@ -256,8 +261,8 @@ class _PlaylistListView extends React.Component {
256261
borderRadius: 10,
257262
}}>
258263
<Image source={{uri: playlist.thumbnail}} resizeMode="cover" style={styles.thumbnail} />
259-
<Text style={{fontWeight: 'bold'}}>{title}</Text>
260-
<Text>{this.props.intl.formatMessage(messages.numVideosWithDuration, {count: playlist.getVideoCount(), duration})}</Text>
264+
<Text style={[styles.boxTitle, styles.boxText]}>{title}</Text>
265+
<Text style={styles.boxText}>{this.props.intl.formatMessage(messages.numVideosWithDuration, {count: playlist.getVideoCount(), duration})}</Text>
261266
</View>
262267
</TouchableHighlight>;
263268
}
@@ -575,13 +580,20 @@ let styles = StyleSheet.create({
575580
},
576581
thumbnail: {
577582
borderRadius: 10,
578-
height: 100,
583+
height: semiNormalize(100),
579584
},
580585
listViewWrapper: {
581586
flex: 1,
582587
borderTopColor: 'black',
583588
borderTopWidth: 1,
584589
},
590+
boxTitle: {
591+
fontWeight: 'bold',
592+
},
593+
boxText: {
594+
fontSize: semiNormalize(14),
595+
lineHeight: normalize(22),
596+
},
585597
playlistListRow: {
586598
padding: 7,
587599
},

js/ui/normalize.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ export function normalize(size: number): number {
1313
return Math.round(scale * size);
1414
}
1515

16-
export function semiNormalize(size: number): number {
17-
return Math.round(size + 0.4 * (normalize(size) - size));
16+
export function semiNormalize(size: number, scalingSpeed: number = 0.4): number {
17+
return Math.round(size + scalingSpeed * (normalize(size) - size));
1818
}

0 commit comments

Comments
 (0)