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

Anna's Spotify Mockup #100

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 6 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
<h1 align="center">
<a href="">
<img src="/src/assets/music-releases.svg" alt="Project Banner Image">
</a>
</h1>

# Music Releases

Replace this readme with your own information about your project.

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
```
This week we started learning about React. Our first project in React was to build a Spotify mockup page.

### The Problem
I started by sketching out on paper how I wanted the structure of the components to be, I changed the structure a couple of times. I wanted it to be as simple as possible so It was easy to follow and understand. I finally choose to divide the components based on the different objects and different features that we should cover and items that belonged to each component. Like for example the icons and hoover effects I imported and added to the the CoverImage files since the icons would show on the images when hoovered.

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?
Then I moved on to importing and exporting components and after that moved on to the styling. It was tricky with the styling of each component but also very easy to follow in the end. I looked at my older projects a lot and of course googled and asked chatGPT. At first I forgot to import the CSS files and could not understand why none of the changes I made was reflected in the browser.

### View it live
If I had more time I would go for the stretch goals and add more hoover effects.

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.

## Instructions
### View it live
https://myspotifymockup.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>SoundScape- My Spotify Mockup</title>
</head>

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

</html>
26 changes: 24 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import data from "./data.json";
import { Album } from "./components/Album.jsx";
import { Header } from "./components/Header.jsx";
import { Footer } from "./components/Footer.jsx";

console.log(data);

export const App = () => {
return <div>Find me in src/app.jsx!</div>;
const { albums } = data;
const renderAlbums = albums.items.map(
({ id, name, external_urls, artists, images }) => (
<Album
key={id}
name={name}
albumUrl={external_urls.spotify}
artists={artists}
image={images[1].url}
/>
)
);
return (
<>
<Header />
<div className="albumSection">{renderAlbums}</div>
<Footer />
</>
);
};


2 changes: 1 addition & 1 deletion src/assets/icons/dots.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/icons/heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/icons/play.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 0 additions & 18 deletions src/assets/music-releases.svg

This file was deleted.

31 changes: 31 additions & 0 deletions src/components/Album.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.album {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 15px;
position: relative;
}

.albumSection {
display: grid;
gap: 10px;
grid-template-columns: repeat(4, 1fr);
}


/* ------------------------------------Media Queries--------------------------------------- */

/* Media query for tablets (2 albums per row) */
@media (max-width: 1024px) {
.albumSection {
grid-template-columns: repeat(2, 1fr);
}
}


/* Media query for mobile (1 album per row) */
@media (max-width: 480px) {
.albumSection {
grid-template-columns: 1fr;
}
}
15 changes: 15 additions & 0 deletions src/components/Album.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable react/prop-types */
import "./Album.css"
import { CoverImage } from "./CoverImage.jsx"
import { AlbumName } from "./AlbumName.jsx"
import { ArtistName } from "./ArtistName.jsx"

export const Album = ({ name, albumUrl, artists, image }) => {
return (
<div className="album">
<CoverImage image={image} />
<AlbumName name={name} albumUrl={albumUrl} />
<ArtistName artists={artists} />
</div>
);
}
19 changes: 19 additions & 0 deletions src/components/AlbumName.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.albumName {
font-size: 14px;
font-weight: bolder;
font-family: Helvetica;
color: #ffffff;
margin: 10px 0px 5px;
}

.albumName a {
text-decoration: none;
color: #ffffff;
transition: color 0.3s ease;
text-align: left;
}

.albumName a:hover {
color: #ffffff;
text-decoration: underline;
}
12 changes: 12 additions & 0 deletions src/components/AlbumName.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable react/prop-types */

import "./AlbumName.css"

export const AlbumName = ({ name, albumUrl }) => {
return (
<p className="albumName">
<span></span>
<a href={albumUrl}>{name}</a>
</p>
);
};
19 changes: 19 additions & 0 deletions src/components/ArtistName.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.artistName span {
font-size: 14px;
font-family: Helvetica;
color: #a0a0a0;
}

.artistName a {
text-decoration: none;
color: #a0a0a0;
transition: color 0.3s ease;
display: inline;
text-align: left;
/* Ensures artist names are on the same line */
}

.artistName a:hover {
color: #fff;
text-decoration: underline;
}
18 changes: 18 additions & 0 deletions src/components/ArtistName.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable react/prop-types */

import "./ArtistName.css";

export const ArtistName = ({ artists }) => {
return (
<div className="artistName">
{artists.map(({ id, name, external_urls }, index) => (
<span key={id}>
<a href={external_urls.spotify}>
{name}
</a>
{index < artists.length - 1 && ", "} {/* Add comma if not last artist */}
</span>
))}
</div>
);
};
55 changes: 55 additions & 0 deletions src/components/CoverImage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.coverImage {
position: relative;
width: 100%;
overflow: hidden;
}

.albumCoverImage {
width: 100%;
height: auto;
display: block;
transition: filter 0.3s ease;
}

.coverImage:hover .albumCoverImage {
filter: brightness(50%);
/* makes the album cover image darker when you hover over it. */
}

.icons {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
gap: 15px;
opacity: 0;
/*Opacity 0, Icons not showing at all */
transition: opacity 0.3s ease;
fill: #ffffff;
}

.coverImage:hover .icons {
opacity: 1;
/*Opacity 1, Icons showing on hoover. */
}

.icon {
width: 30px;
height: 30px;
cursor: pointer;
transition: transform 0.3s ease;
}

.play.icon:hover {
transform: scale(1.2);
/* Makes play icon grow on hoover */
}

.play.icon {
width: 60px;
height: 60px;
}
22 changes: 22 additions & 0 deletions src/components/CoverImage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable react/prop-types */
import "./CoverImage.css"

import dots from "../assets/icons/dots.svg"
import heart from "../assets/icons/heart.svg"
import playIcon from "../assets/icons/play.svg"

export const CoverImage = ({ image }) => {

return (
<div className="coverImage">
<img src={image} alt="Album cover image" className="albumCoverImage" />
<div className="icons">
<img src={heart} alt="Heart" className="heart icon" />
<img src={playIcon} alt="Play" className="play icon" />
<img src={dots} alt="dots" className="dots icon" />
</div>
</div>

)

}
16 changes: 16 additions & 0 deletions src/components/Footer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.Footer {
top: 0;
left: 0;
width: 100%;
color: #a0a0a0;
font-weight: 300;
text-align: center;
box-sizing: border-box;
/* Include padding in the element's total width */
}

footer p {
font-size: 15px;
font-weight: 400;
margin: 30px 0px 30px;
}
11 changes: 11 additions & 0 deletions src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "./Footer.css"

export const Footer = () => {
return (
<>
< footer className="Footer">
<p>Created by Anna Hansen, Technigo 2024</p>
</footer >
</>
);
};
27 changes: 27 additions & 0 deletions src/components/Header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.Header {
top: 0;
left: 0;
width: 100%;
color: #ffffff;
text-align: center;
box-sizing: border-box;
/* Include padding in the element's total width */
}

img.logo {
width: 100px;
height: auto;
display: block;
margin: 15px auto;
}

h1 {
font-size: 35px;
margin: 10px 0px;
}

header p {
font-size: 20px;
margin: 10px 0px;
padding-bottom: 15px;
}
16 changes: 16 additions & 0 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import "./Header.css"
import logo from "../assets/logo.png"

export const Header = () => {
return (
<>
< header className="Header">
<h1><img src={logo} alt="logo" className="SoundScape logo" />SoundScape</h1>
<p>Explore trending artists and albums</p>
</header >
</>
);
};



Loading