-
Notifications
You must be signed in to change notification settings - Fork 1
/
CellChampion.js
76 lines (66 loc) · 1.55 KB
/
CellChampion.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
var React = require('react-native');
var REQUEST_IMAGE_CHAMP_SMALL = 'http://ddragon.leagueoflegends.com/cdn/5.9.1/img/champion/';
var {
View,
Image,
Text,
TouchableHighlight,
StyleSheet,
} = React;
'use strict';
CellChampion = React.createClass({
render: function() {
var urlImage = REQUEST_IMAGE_CHAMP_SMALL + this.props.champion.image.full;
this.props.champion.title = this.props.champion.title.replace(
/^[a-z]/, function(m){
return m.toUpperCase()
}
);
return (
<View>
<TouchableHighlight onPress={this.props.onSelect}>
<View style={styles.container}>
<Image
style={styles.image}
source={{uri: urlImage}}
/>
<View style={styles.rightContainer}>
<Text style={styles.name}>{this.props.champion.name}</Text>
<Text style={styles.title}>{this.props.champion.title}</Text>
</View>
</View>
</TouchableHighlight>
</View>
);
},
});
var styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'black',
borderWidth: .75,
borderColor: '#5C5C5C',
},
rightContainer: {
flex: 1,
},
name: {
fontSize: 20,
color: 'white',
marginBottom: 8,
textAlign: 'center',
},
title: {
textAlign: 'center',
color: 'white',
},
image: {
width: 60,
height: 60,
borderWidth: 1,
borderColor: '#5C5C5C',
},
});
module.exports = CellChampion;