Albums page data and CSS
This commit is contained in:
parent
314bac4de5
commit
d581d87f89
8 changed files with 89 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import './Artist.scss'
|
import './Album.scss'
|
||||||
|
|
||||||
function Album({ props, callback }) {
|
function Album({ props, callback }) {
|
||||||
let [rate, setRate] = useState([])
|
let [rate, setRate] = useState([])
|
||||||
|
@ -9,7 +9,7 @@ function Album({ props, callback }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='artist' onClick={openAlbums}>
|
<div className='album' onClick={openAlbums}>
|
||||||
<div className='picture'>
|
<div className='picture'>
|
||||||
{props.images.length > 0 && (
|
{props.images.length > 0 && (
|
||||||
<img src={props.images[0].url} />
|
<img src={props.images[0].url} />
|
||||||
|
@ -17,10 +17,18 @@ function Album({ props, callback }) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='details'>
|
<div className='details'>
|
||||||
<div className='text'>
|
<div className='top'>
|
||||||
<h2>{props.name}</h2>
|
<div className='title'><h2>{props.name}</h2></div>
|
||||||
|
<p>{props.artists[0].name}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='bottom'>
|
||||||
|
<p>{props.release_date}</p>
|
||||||
|
<p>{props.total_tracks} {props.total_tracks === 1 ? 'track' : 'tracks'}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button>Preview on Spotify</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
67
src/components/Album.scss
Normal file
67
src/components/Album.scss
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
.album {
|
||||||
|
border: solid thin #b6b6b6;
|
||||||
|
width: 12em;
|
||||||
|
height: 18.5em;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.picture {
|
||||||
|
border-bottom: solid thin #b6b6b6;
|
||||||
|
background: #d7d7d7;
|
||||||
|
height: 9em;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
img {
|
||||||
|
min-height: 9em;
|
||||||
|
max-width: 12em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.details {
|
||||||
|
display: inline-table;
|
||||||
|
position: relative;
|
||||||
|
height: 9.5em;
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
max-height: 44px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 14pt;
|
||||||
|
margin: 0 0 3px 0;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
color: #787878;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
padding: 10px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
height: 2.5em;
|
||||||
|
width: 100%;
|
||||||
|
color: #868686;
|
||||||
|
background: #f1f1f1;
|
||||||
|
font-weight: bold;
|
||||||
|
border: none;
|
||||||
|
border-top: solid thin #b6b6b6;
|
||||||
|
border-bottom: solid thin #b6b6b6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,7 +15,7 @@ function Artist({ props, callback }) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let stars = []
|
let stars = []
|
||||||
for (let i=0; i<Math.floor(props.popularity/20); i++) {
|
for (let i=0; i<Math.ceil(props.popularity/20); i++) {
|
||||||
stars.push(star)
|
stars.push(star)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ function Albums({ props }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='albums'>
|
<div className='spotify'>
|
||||||
<h1>Albums</h1>
|
<h1>Albums</h1>
|
||||||
|
|
||||||
{albums && (
|
{albums && (
|
||||||
|
|
|
@ -23,7 +23,7 @@ function ArtistSearch({ props }) {
|
||||||
|
|
||||||
// Search artists
|
// Search artists
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (search && search.length > 4) {
|
if (search && search.length > 2) {
|
||||||
spotifyApi.searchArtists(search)
|
spotifyApi.searchArtists(search)
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
setArtists(data.artists.items)
|
setArtists(data.artists.items)
|
||||||
|
@ -56,7 +56,7 @@ function ArtistSearch({ props }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="artist-search">
|
<div className="spotify">
|
||||||
<h1>Artist search</h1>
|
<h1>Artist search</h1>
|
||||||
|
|
||||||
<input placeholder='Search for an artist' onChange={handleChange} />
|
<input placeholder='Search for an artist' onChange={handleChange} />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.artist-search {
|
.spotify {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import './Login.scss'
|
||||||
|
|
||||||
function Login() {
|
function Login() {
|
||||||
return (
|
return (
|
||||||
<div className="artist-search">
|
<div className='login'>
|
||||||
<h1>Touch Tunes</h1>
|
<h1>Touch Tunes</h1>
|
||||||
|
|
||||||
<a href='http://localhost:8888/login' className='App-link'> Login to Spotify </a>
|
<a href='http://localhost:8888/login' className='App-link'> Login to Spotify </a>
|
||||||
|
|
3
src/views/Login.scss
Normal file
3
src/views/Login.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.login {
|
||||||
|
text-align: center;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue