Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jonas Music release app #101

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ module.exports = {
'warn',
{ allowConstantExport: true },
],
'react/prop-types': 'off'
},
}
}
29 changes: 8 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,19 @@

# Music Releases

Replace this readme with your own information about your project.
This task involved building a React app that displays music releases using data from a Spotify API response. The app features album covers, artist names, and various hover effects, such as showing icons (play, heart, dots) when hovering over an album cover.

Start by briefly describing the assignment in a sentence or two. Keep it short and to the point.

## Getting Started with the Project

### Dependency Installation & Startup Development Server

Once cloned, navigate to the project's root directory and this project uses npm (Node Package Manager) to manage its dependencies.

The command below is a combination of installing dependencies, opening up the project on VS Code and it will run a development server on your terminal.

```bash
npm i && code . && npm run dev
```

### The Problem

Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next?
I encountered several challenges during the project, including:

### View it live
Positioning icons correctly: Initially, the icons were hidden behind the overlay. I resolved this by adjusting the z-index so that the icons appear above the overlay on hover.
Handling commas between artist names: I needed to dynamically add commas between artist names. I solved this by using conditional logic in the ArtistName component.
Styling issues: I encountered problems with unwanted spaces and default underlines on links. I fixed these by adjusting margins and using text-decoration: none for the default state and underline for the hover state.
These changes allowed the app to function as expected and match the project requirements.
Comment on lines +16 to +19

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great reflections! ⭐


Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about.
### View it live

## Instructions
https://jonas-music-releases.netlify.app/

<a href="instructions.md">
See instructions of this project
</a>
25 changes: 14 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Music Releases</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Jonas Music Releases</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>

</html>
18 changes: 14 additions & 4 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import data from "./data.json";

console.log(data);
import React from 'react';
import data from './data.json';
import { Header } from './components/Header';
import { Album } from './components/Album';

export const App = () => {
return <div>Find me in src/app.jsx!</div>;
return (
<div>
<Header />
<div className="App">
{data.albums.items.map((album) => (
<Album key={album.id} album={album} />
))}
</div>
</div>
);
};
26 changes: 26 additions & 0 deletions src/components/Album.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import { ArtistName } from "./ArtistName";
import { AlbumName } from "./AlbumName";
import { AlbumCover } from "./AlbumCover";
import './App.css';

export const Album = ({ album }) => {
const totalArtists = album.artists.length;

return (
<div className="album">
<AlbumCover imageUrl={album.images[0].url} alt={album.name} />
<AlbumName name={album.name} url={album.external_urls.spotify} />
<div className="artists">
{album.artists.map((artist, index) => (
<ArtistName
key={artist.id}
artist={artist}
index={index}
totalArtists={totalArtists}
/>
))}
</div>
</div>
);
};
84 changes: 84 additions & 0 deletions src/components/AlbumCover.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.cover-container {
position: relative;
width: 100%;
}

.album-cover {
width: 100%;
height: auto;
border-radius: 8px;
z-index: 1;

}

.icons {
display: flex;
justify-content: center;
color: white;
align-items: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;

transition: opacity 0.3s ease;
z-index: 4;

}

.cover-container:hover .icons {
opacity: 1;

}

.icon-small {
width: 35px;
height: 35px;
align-self: center;
filter: brightness(0) invert(1);

padding: 10px;
opacity: 50%;
}

.icon-big {
width: 60px;
height: 60px;
align-self: center;
padding: 10px;
transition: transform 0.3s ease;
filter: brightness(0) invert(1);

opacity: 50%;
}

.icon-big:hover {
transform: scale(1.2);
opacity: 100%;

}

.icon-small:hover {
opacity: 100%;

}

.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0);
z-index: 2;
transition: background-color 0.3s ease;

}

.cover-container:hover .overlay {
background-color: rgba(0, 0, 0, 0.5);
z-index: 3;

}
20 changes: 20 additions & 0 deletions src/components/AlbumCover.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import './AlbumCover.css';
import dotsIcon from "../assets/icons/dots.svg";
import heartIcon from "../assets/icons/heart.svg";
import playIcon from "../assets/icons/play.svg";


export const AlbumCover = ({ imageUrl, alt }) => {
return (
<div className="cover-container ">
<img className="album-cover" src={imageUrl} alt={alt} />
<div className="overlay"></div>
<div className="icons">
<img className="icon-small" src={heartIcon} alt="heart-icon" />
<img className="icon-big" src={playIcon} alt="play-icon" />
<img className="icon-small" src={dotsIcon} alt="dots-icon" />
</div>
</div>
);
};
13 changes: 13 additions & 0 deletions src/components/AlbumName.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.album-name {
font-family: Helvetica, sans-serif;
color: white;
font-size: 14px;
text-decoration: none;


}

.album-name:hover {
text-decoration: underline;

}
10 changes: 10 additions & 0 deletions src/components/AlbumName.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import './AlbumName.css';

export const AlbumName = ({ name, url }) => {
return (
<a href={url} target="_blank" rel="noopener noreferrer" className="album-name">
{name}
</a>
);
};
30 changes: 30 additions & 0 deletions src/components/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.App {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
background-color: #000000;
color: white;
padding: 15px;
text-align: left;


}


/* Mobile */

@media (max-width: 768px) {
.App {
grid-template-columns: repeat(1, 1fr);

}
}

/* Ipads */

@media (max-width: 1024px) and (min-width: 767px) {
.App {
grid-template-columns: repeat(2, 1fr);

}
}
13 changes: 13 additions & 0 deletions src/components/ArtistName.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.artist-name {
font-family: Helvetica, sans-serif;
color: #a0a0a0;
font-size: 14px;
text-decoration: none;


}

.artist-name:hover {
text-decoration: underline;

}
20 changes: 20 additions & 0 deletions src/components/ArtistName.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import './ArtistName.css';

export const ArtistName = ({ artist, index, totalArtists }) => {
let separator = "";


if (index < totalArtists - 1) {
separator = " & ";
}

return (
<span>
<a href={artist.external_urls.spotify} target="_blank" rel="noopener noreferrer" className="artist-name">
{artist.name}
</a>
{separator}
</span>
);
};
13 changes: 13 additions & 0 deletions src/components/Header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.header {
background-color: rgb(0, 0, 0);



}

h1 {
margin: 0;
padding: 20px;
text-align: center;
color: white;
}
12 changes: 12 additions & 0 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import './Header.css';

export const Header = () => {
return (
<div className="header">
<h1>Music releases</h1>
</div>
);

}