-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Recommendation, Latest music logic
- Loading branch information
Showing
15 changed files
with
263 additions
and
24 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
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,19 @@ | ||
import React from 'react' | ||
import { Icon } from '@blueprintjs/core' | ||
import cn from 'classnames' | ||
|
||
import styles from './style.module.css' | ||
|
||
interface IProps { | ||
className?: string | ||
} | ||
|
||
const PlayIcon: React.FC<IProps> = ({ className }) => { | ||
return ( | ||
<div className={cn(styles.root, className)}> | ||
<Icon icon='play' /> | ||
</div> | ||
) | ||
} | ||
|
||
export default PlayIcon |
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 @@ | ||
@value colors: "~styles/colors.module.css"; | ||
@value red from colors; | ||
|
||
.root { | ||
width: 25px; | ||
height: 25px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-radius: 50%; | ||
background-color: rgba(255, 255, 255, 0.8); | ||
color: red; | ||
} |
45 changes: 45 additions & 0 deletions
45
src/pages/Discovery/Recommendation/LatestMusic/MusicItem/index.tsx
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,45 @@ | ||
import React from 'react' | ||
import cn from 'classnames' | ||
|
||
import PlayIcon from 'components/PlayIcon' | ||
import { IArtist } from 'apis/types/personalized' | ||
|
||
import styles from './style.module.css' | ||
|
||
interface IProps { | ||
name: string, | ||
picUrl: string, | ||
artists: IArtist[], | ||
index: number | ||
} | ||
|
||
const MusicItem: React.FC<IProps> = ({ name, picUrl, artists, index }) => { | ||
const hasBorderBottom = [4, 9].indexOf(index) > -1 | ||
|
||
return ( | ||
<div className={cn(styles.root, hasBorderBottom ? styles.borderBottom : '')}> | ||
<div className={styles.pic}> | ||
<img src={`${picUrl}?param=60y60`} /> | ||
<PlayIcon className={styles.playIcon} /> | ||
</div> | ||
<div className={styles.order}> | ||
{index < 9 ? `0${index + 1}` : index + 1} | ||
</div> | ||
<div className={styles.info}> | ||
<div className={styles.name}> | ||
{name} | ||
</div> | ||
<div className={styles.singers}> | ||
{artists?.map(({ name }, index) => | ||
(index !== artists?.length - 1 | ||
? <div key={name}><span className={styles.singer}>{name}</span><span className={styles.slash}>/</span></div> | ||
: <span key={name} className={styles.singer}>{name}</span> | ||
) | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default MusicItem |
66 changes: 66 additions & 0 deletions
66
src/pages/Discovery/Recommendation/LatestMusic/MusicItem/style.module.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,66 @@ | ||
@value colors: "~styles/colors.module.css"; | ||
@value nameColor, tipsColor from colors; | ||
|
||
.root { | ||
display: flex; | ||
align-items: center; | ||
padding: 10px 0; | ||
border-top: 1px solid #f5f5f5; | ||
} | ||
|
||
.borderBottom { | ||
border-bottom: 1px solid #f5f5f5; | ||
} | ||
|
||
.pic { | ||
width: 60px; | ||
height: 60px; | ||
border-radius: 5px; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
position: relative; | ||
margin-right: 10px; | ||
cursor: pointer; | ||
|
||
img { | ||
border-radius: 5px; | ||
} | ||
|
||
.playIcon { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
} | ||
|
||
.order { | ||
margin-right: 10px; | ||
font-size: 0.9em; | ||
color: tipsColor; | ||
} | ||
|
||
.info { | ||
.name { | ||
color: nameColor; | ||
} | ||
|
||
.singers { | ||
display: flex; | ||
align-items: center; | ||
color: tipsColor; | ||
} | ||
|
||
.singer { | ||
margin-top: 5px; | ||
font-size: 0.9em; | ||
cursor: pointer; | ||
|
||
&:hover { | ||
color: #797979; | ||
} | ||
} | ||
|
||
.slash { | ||
margin: 0 5px; | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/pages/Discovery/Recommendation/LatestMusic/style.module.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,8 @@ | ||
.content { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.block { | ||
width: 48%; | ||
} |
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
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
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,3 +1,7 @@ | ||
.root { | ||
padding: 10px 0; | ||
} | ||
|
||
.block { | ||
margin-bottom: 50px; | ||
} |
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 |
---|---|---|
|
@@ -5,5 +5,4 @@ | |
width: 94%; | ||
max-width: contentMaxWidth; | ||
margin: 0 auto; | ||
background-color: #ccc; | ||
} |
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,3 +1,5 @@ | ||
@value red: #c7332f; | ||
@value grey: #7d7d7d; | ||
@value black: #000; | ||
@value nameColor: #5d5d5d; | ||
@value tipsColor: #bababa; |