-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
181 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,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<!-- normalize --> | ||
<link rel="stylesheet" href="../../node_modules/normalize.css/normalize.css" /> | ||
<!-- global css --> | ||
<link rel="stylesheet" href="../styles/global.css" /> | ||
<!-- main css --> | ||
<link rel="stylesheet" href="main.css" /> | ||
<title>deezer search</title> | ||
</head> | ||
|
||
<body> | ||
<navbar-stack></navbar-stack> | ||
|
||
<main class="container"> | ||
<section class="app-glass"> | ||
<fieldset class="input-field"> | ||
<input type="text" id="search" class="input-field-text" placeholder="enter a search query" required /> | ||
</fieldset> | ||
<fieldset class="input-field"> | ||
<button id="analyze-button" class="btn-submit full-btn">start search</button> | ||
</fieldset> | ||
</section> | ||
|
||
<section id="albums" class="albums"></section> | ||
</main> | ||
|
||
<!-- render window script --> | ||
<script async src="renderer.js"></script> | ||
</body> | ||
|
||
</html> |
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,34 @@ | ||
.albums { | ||
height: 70vh; | ||
overflow: auto; | ||
margin-top: 10px; | ||
} | ||
|
||
.album { | ||
display: grid; | ||
grid-template-areas: | ||
"img title" | ||
"img list"; | ||
margin-bottom: 8px; | ||
padding: 10px; | ||
color: #fff; | ||
} | ||
|
||
.album-img { | ||
grid-area: img; | ||
display: block; | ||
border-radius: 7%; | ||
width: 128px; | ||
} | ||
|
||
.album-title { | ||
grid-area: title; | ||
margin-block: 8px; | ||
font-size: 1.1em; | ||
} | ||
|
||
.album-desc { | ||
margin: 0; | ||
padding: 0; | ||
grid-area: list; | ||
} |
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,73 @@ | ||
// modules | ||
const { ipcRenderer } = require('electron') | ||
const axios = require('axios') | ||
const toast = require('../scripts/toast') | ||
|
||
// DOM elements | ||
const search = document.querySelector('#search') | ||
const analyzeButton = document.querySelector('#analyze-button') | ||
const albumsList = document.querySelector('#albums') | ||
|
||
// method | ||
const deezerSearch = async () => { | ||
if(!search.value) { | ||
return toast('this field is required') | ||
} | ||
|
||
try { | ||
const { data } = await axios.get( | ||
'https://api.deezer.com/search/album', { | ||
params: { | ||
q: search.value | ||
} | ||
}) | ||
|
||
data.data.forEach((album) => { | ||
// create Elements | ||
const albumContainer = document.createElement('article') | ||
const albumCover = document.createElement('img') | ||
const albumName = document.createElement('h2') | ||
const albumInfoList = document.createElement('ul') | ||
const albumRecordType = document.createElement('li') | ||
const albumArtist = document.createElement('li') | ||
const albumTotalTracks = document.createElement('li') | ||
const albumLyricsType = document.createElement('li') | ||
|
||
albumContainer.classList.add('app-glass', 'album') | ||
|
||
// image | ||
albumCover.src = album?.cover_medium ?? '../images/not-found.jpg' | ||
albumCover.alt = album.id | ||
albumCover.classList.add('album-img') | ||
|
||
// album title | ||
albumName.textContent = album.title | ||
albumName.classList.add('album-title') | ||
|
||
// list elements | ||
albumInfoList.classList.add('album-desc') | ||
|
||
albumArtist.textContent = `artist: ${album.artist.name}` | ||
albumRecordType.textContent = `record type: ${album.record_type}` | ||
albumTotalTracks.textContent = `tracks: ${album.nb_tracks}` | ||
albumLyricsType.textContent = album.explicit_lyrics | ||
? 'explicit lyrics' | ||
: 'clean lyrics' | ||
|
||
albumInfoList.append(albumArtist, albumRecordType, albumTotalTracks, albumLyricsType) | ||
|
||
// append elements | ||
albumContainer.append(albumCover, albumName, albumInfoList) | ||
albumsList.append(albumContainer) | ||
}) | ||
} catch(err) { toast(err.message) } | ||
} | ||
|
||
analyzeButton.addEventListener('click', () => { | ||
deezerSearch() | ||
search.value = '' | ||
}) | ||
|
||
ipcRenderer.on('clear-stack', () => { | ||
albumsContainer.innerHTML = '' | ||
}) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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