-
Notifications
You must be signed in to change notification settings - Fork 16
/
AlbumsRow.js
76 lines (64 loc) · 1.46 KB
/
AlbumsRow.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
'use strict';
import React, { Component } from 'react';
import {
StyleSheet,
View,
TouchableHighlight,
Text,
Image
} from 'react-native';
function yearFromReleaseDate(releaseDate) {
return (new Date(releaseDate)).getFullYear();
}
var AlbumsRow = React.createClass({
render() {
var album = this.props.rowData;
var year = yearFromReleaseDate(album.releaseDate);
return (
<TouchableHighlight
onPress={this.props.onPress}
underlayColor="#CCCCCC">
<View>
<View style={styles.rowContainer}>
<Image style={styles.thumb} source={{uri: album.artworkUrl100}} />
<View style={styles.textContainer}>
<Text style={styles.title}
numberOfLines={2}>{album.collectionName} ({year})</Text>
<Text style={styles.subtitle}
numberOfLines={1}>{album.artistName}</Text>
</View>
</View>
<View style={styles.separator} />
</View>
</TouchableHighlight>
);
}
});
const styles = StyleSheet.create({
rowContainer: {
flexDirection: 'row',
padding: 10
},
textContainer: {
flex: 1
},
thumb: {
width: 80,
height: 80,
marginRight: 10
},
title: {
fontSize: 20,
color: '#FF8000',
fontWeight: 'bold'
},
subtitle: {
fontSize: 16,
color: '#656565'
},
separator: {
height: 1,
backgroundColor: '#dddddd'
},
});
module.exports = AlbumsRow;