-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
129 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/components/window/Playlist/PlaylistTab/Collector/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { Component } from 'react' | ||
|
||
class Collector extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
Collector | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Collector |
6 changes: 3 additions & 3 deletions
6
src/components/window/Playlist/SongList.jsx → ...ow/Playlist/PlaylistTab/Comment/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import React, { Component } from 'react' | ||
|
||
class SongList extends Component { | ||
class Comment extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
SongList | ||
Comment | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default SongList | ||
export default Comment |
29 changes: 29 additions & 0 deletions
29
src/components/window/Playlist/PlaylistTab/SongList/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.list-item { | ||
font-size: 15px; | ||
padding: 5px 0; | ||
} | ||
|
||
.list-item-index { | ||
display: inline-block; | ||
width: 6%; | ||
} | ||
|
||
.list-item-name { | ||
display: inline-block; | ||
width: 30%; | ||
} | ||
|
||
.list-item-singers { | ||
display: inline-block; | ||
width: 20%; | ||
} | ||
|
||
.list-item-album { | ||
display: inline-block; | ||
width: 30%; | ||
} | ||
|
||
.list-item-time { | ||
display: inline-block; | ||
width: 14%; | ||
} |
58 changes: 58 additions & 0 deletions
58
src/components/window/Playlist/PlaylistTab/SongList/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React, { Component } from 'react' | ||
import Style from './index.css' | ||
|
||
class SongList extends Component { | ||
render() { | ||
const { data=[] } = this.props | ||
|
||
const List = data.map((item, index)=>{ | ||
const { | ||
ar = [], | ||
al = {}, | ||
name = 'Unknown', | ||
dt = 0 | ||
} = item | ||
const hh = parseInt(dt/(60*60*1000), 10) | ||
const mm = parseInt((dt-hh*60*60*1000)/(60*1000), 10) | ||
const ss = parseInt((dt-hh*60*60*1000-mm*60*1000)/(1000), 10) | ||
const getTime = ()=>{ | ||
if(hh!==0) { | ||
return `${hh}:${mm>=10?mm:`0${mm}`}:${ss>=10?ss:`0${ss}`}` | ||
}else { | ||
return `${mm>=10?mm:`0${mm}`}:${ss>=10?ss:`0${ss}`}` | ||
} | ||
} | ||
|
||
const singer = ()=>{ | ||
const res = [] | ||
for(let i = 0; i<ar.length*2; i++) { | ||
if (i%2===0) { | ||
res.push(<span>{ ar[i/2].name }</span>) | ||
}else if(i!==(ar.length*2-1)) { | ||
res.push(<span>/</span>) | ||
} | ||
} | ||
return res | ||
} | ||
|
||
return ( | ||
<div className={ Style['list-item'] }> | ||
<span className={ Style['list-item-index'] }>{ index+1>=10?index+1:`0${index+1}` }</span> | ||
<span className={ Style['list-item-name'] }>{ name }</span> | ||
<span className={ Style['list-item-singers'] }>{ singer() }</span> | ||
<span className={ Style['list-item-album'] }>{ al.name }</span> | ||
<span className={ Style['list-item-time'] }>{ getTime() }</span> | ||
</div> | ||
) | ||
}) | ||
|
||
return ( | ||
<div> | ||
<div></div> | ||
<div>{ List }</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default SongList |