Skip to content

Commit

Permalink
Challenge and Code: Artist Component
Browse files Browse the repository at this point in the history
  • Loading branch information
15Dkatz committed Oct 20, 2022
1 parent 11e26bc commit 829e344
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 7 deletions.
93 changes: 87 additions & 6 deletions music-master/dist/index.975ef6c8.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion music-master/dist/index.975ef6c8.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions music-master/src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import Artist from './Artist';

const API_ADDRESS = 'https://spotify-api-wrapper.appspot.com';

Expand Down Expand Up @@ -46,6 +47,7 @@ class App extends Component {
placeholder='Search for an artist'
/>
<button onClick={this.searchArtist}>Search</button>
<Artist artist={this.state.artist} />
</div>
);
}
Expand Down
27 changes: 27 additions & 0 deletions music-master/src/components/Artist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';

const Artist = ({ artist }) => {
if (!artist) return null;

const { images, name, followers, genres } = artist;

return (
<div>
<h3>{name}</h3>
<p>{followers.total} followers</p>
<p>{genres.join(',')}</p>
<img
src={images[0] && images[0].url}
alt='artist-profile'
style={{
width: 200,
height: 200,
borderRadius: 100,
objectFit: 'cover'
}}
/>
</div>
);
}

export default Artist;

0 comments on commit 829e344

Please sign in to comment.