Skip to content

Commit dbcb315

Browse files
committed
[mobile] highlight current song
1 parent 8a900fd commit dbcb315

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

mobile/src/Components/Songs/Songs.tsx

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from '@emotion/native';
22
import React, {FC} from 'react';
3-
import {TouchableOpacity, TouchableWithoutFeedback} from 'react-native';
3+
import {TouchableWithoutFeedback} from 'react-native';
44
import Feather from 'react-native-vector-icons/Feather';
55
import {Track as TrackType} from '../../Types';
66

@@ -33,7 +33,6 @@ const TrackRow = styled.View`
3333
align-items: center;
3434
margin: 0 20px;
3535
height: 60px;
36-
margin-bottom: 15px;
3736
`;
3837

3938
const TrackTitle = styled.Text<{active?: boolean}>`
@@ -70,6 +69,16 @@ const NoCover = styled.View`
7069
border-radius: 3px;
7170
`;
7271

72+
const TrackWrapper = styled.View`
73+
background-color: #232323;
74+
`;
75+
76+
const TouchableTrack = styled.TouchableOpacity`
77+
background-color: #000;
78+
justify-content: center;
79+
height: 70px;
80+
`;
81+
7382
export type TrackProps = {
7483
item: any;
7584
active: boolean;
@@ -79,24 +88,26 @@ export type TrackProps = {
7988
const Track: FC<TrackProps> = props => {
8089
const {item, active, onPress} = props;
8190
return (
82-
<TouchableOpacity onPress={() => onPress(item)}>
83-
<TrackRow>
84-
{item.cover && <Cover source={{uri: item.cover}} />}
85-
{!item.cover && (
86-
<NoCover>
87-
<Feather name="music" size={30} color="#a7a7a9" />
88-
</NoCover>
89-
)}
90-
<TrackInfo>
91-
<TrackTitle active={active} ellipsizeMode="tail" numberOfLines={1}>
92-
{item.title}
93-
</TrackTitle>
94-
<TrackArtist ellipsizeMode="tail" numberOfLines={1}>
95-
{item.artist}
96-
</TrackArtist>
97-
</TrackInfo>
98-
</TrackRow>
99-
</TouchableOpacity>
91+
<TrackWrapper>
92+
<TouchableTrack onPress={() => onPress(item)}>
93+
<TrackRow>
94+
{item.cover && <Cover source={{uri: item.cover}} />}
95+
{!item.cover && (
96+
<NoCover>
97+
<Feather name="music" size={30} color="#a7a7a9" />
98+
</NoCover>
99+
)}
100+
<TrackInfo>
101+
<TrackTitle active={active} ellipsizeMode="tail" numberOfLines={1}>
102+
{item.title}
103+
</TrackTitle>
104+
<TrackArtist ellipsizeMode="tail" numberOfLines={1}>
105+
{item.artist}
106+
</TrackArtist>
107+
</TrackInfo>
108+
</TrackRow>
109+
</TouchableTrack>
110+
</TrackWrapper>
100111
);
101112
};
102113

0 commit comments

Comments
 (0)