forked from calebnance/expo-spotify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLineItemSong.js
More file actions
97 lines (90 loc) · 2.29 KB
/
LineItemSong.js
File metadata and controls
97 lines (90 loc) · 2.29 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import React from 'react';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import PropTypes from 'prop-types';
import { Feather, Ionicons } from '@expo/vector-icons';
import { colors, fonts, gStyle } from '../api';
const LineItemSong = ({ active, downloaded, onPress, songData }) => (
<View style={styles.container}>
<TouchableOpacity
activeOpacity={gStyle.activeOpacity}
onPress={() => onPress(songData)}
style={gStyle.flex5}
>
<Text
style={[
styles.title,
{ color: active ? colors.brandPrimary : colors.white }
]}
>
{songData.title}
</Text>
<View style={gStyle.flexRow}>
{downloaded && (
<View style={styles.circleDownloaded}>
<Ionicons
color={colors.blackBg}
name="ios-arrow-round-down"
size={14}
/>
</View>
)}
<Text style={styles.artist}>{songData.artist}</Text>
</View>
</TouchableOpacity>
<View style={styles.containerRight}>
<Feather color={colors.greyLight} name="more-horizontal" size={20} />
</View>
</View>
);
LineItemSong.defaultProps = {
active: false,
downloaded: false
};
LineItemSong.propTypes = {
// required
onPress: PropTypes.func.isRequired,
songData: PropTypes.shape({
album: PropTypes.string.isRequired,
artist: PropTypes.string.isRequired,
image: PropTypes.string.isRequired,
length: PropTypes.number.isRequired,
title: PropTypes.string.isRequired
}).isRequired,
// optional
active: PropTypes.bool,
downloaded: PropTypes.bool
};
const styles = StyleSheet.create({
container: {
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
padding: 16,
width: '100%'
},
title: {
color: colors.white,
fontFamily: fonts.spotifyRegular,
fontSize: 16,
marginBottom: 4
},
circleDownloaded: {
alignItems: 'center',
backgroundColor: colors.brandPrimary,
borderRadius: 7,
height: 14,
justifyContent: 'center',
marginRight: 8,
width: 14
},
artist: {
color: colors.greyInactive,
fontFamily: fonts.spotifyRegular,
fontSize: 12
},
containerRight: {
alignItems: 'flex-end',
flex: 1
}
});
export default LineItemSong;