generated from microverseinc/readme-template
-
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.
Merge pull request #26 from XsidX/api-display-home
Add items in home page
- Loading branch information
Showing
5 changed files
with
134 additions
and
95 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
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,29 @@ | ||
import { getAnime, getLikes } from './API.js'; | ||
|
||
const section = document.querySelector('.content'); | ||
|
||
const homePage = async () => { | ||
const data = await getAnime(); | ||
const likesData = await getLikes(); | ||
let numLike = 0; | ||
data.forEach((anime) => { | ||
likesData.find((like) => { | ||
if (like.item_id === anime.mal_id) { | ||
numLike = like.likes; | ||
} | ||
return numLike; | ||
}); | ||
section.innerHTML += `<div class="item"> | ||
<div class="img-container"> | ||
<img src='${anime.images.jpg.image_url}' alt='${anime.title} image '> | ||
</div> | ||
<h6>${anime.title}</h6> | ||
<h6><i class="fa fa-heart" data-likeid='${anime.mal_id}'></i>${numLike} Likes</h6> | ||
<br> | ||
<button class="btn btn-info">Comment</button> | ||
<button class="btn btn-success">Reservetion</button> | ||
</div>`; | ||
}); | ||
}; | ||
|
||
export default homePage; |
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 |
---|---|---|
@@ -1,65 +1,67 @@ | ||
.navbar-list { | ||
background-color: #56adbf; | ||
height: 90px; | ||
width: 100%; | ||
} | ||
|
||
.navbar-list h1 { | ||
color: #fff; | ||
margin: 24px 0 0 117px; | ||
position: absolute; | ||
} | ||
|
||
.nav-list { | ||
float: right; | ||
list-style: none; | ||
margin-top: 30px; | ||
margin-right: 6%; | ||
} | ||
|
||
.nav-list li { | ||
display: inline; | ||
color: #fff; | ||
font-size: 20px; | ||
padding: 30px; | ||
} | ||
|
||
.content { | ||
display: grid; | ||
grid-template-columns: auto auto auto; | ||
justify-content: center; | ||
} | ||
|
||
.item { | ||
padding: 20px; | ||
} | ||
|
||
.img { | ||
height: 100px; | ||
width: 100px; | ||
border: 1px solid black; | ||
} | ||
|
||
.item h6 { | ||
display: inline; | ||
float: left; | ||
padding: 10px; | ||
} | ||
|
||
.item h6 i { | ||
color: red; | ||
} | ||
|
||
.footer { | ||
position: absolute; | ||
bottom: 0; | ||
width: 99%; | ||
height: 60px; /* Height of the footer */ | ||
background: #56adbf; | ||
} | ||
|
||
.footer span { | ||
color: #fff; | ||
margin: 24px 0 0 20px; | ||
position: absolute; | ||
} | ||
.navbar-list { | ||
background-color: #56adbf; | ||
height: 90px; | ||
width: 100%; | ||
} | ||
|
||
.navbar-list h1 { | ||
color: #fff; | ||
margin: 24px 0 0 117px; | ||
position: absolute; | ||
} | ||
|
||
.nav-list { | ||
float: right; | ||
list-style: none; | ||
margin-top: 30px; | ||
margin-right: 6%; | ||
} | ||
|
||
.nav-list li { | ||
display: inline; | ||
color: #fff; | ||
font-size: 20px; | ||
padding: 30px; | ||
} | ||
|
||
.content { | ||
display: grid; | ||
grid-template-columns: auto auto auto; | ||
justify-content: center; | ||
} | ||
|
||
.item { | ||
padding: 20px; | ||
} | ||
|
||
.img-container { | ||
width: 100%; | ||
height: 50vh; | ||
} | ||
|
||
.img-container img { | ||
height: 100%; | ||
width: 100%; | ||
} | ||
|
||
.item h6 { | ||
display: inline; | ||
float: left; | ||
padding: 10px; | ||
} | ||
|
||
.item h6 i { | ||
color: red; | ||
} | ||
|
||
.footer { | ||
width: 99%; | ||
height: 60px; /* Height of the footer */ | ||
background: #56adbf; | ||
} | ||
|
||
.footer span { | ||
color: #fff; | ||
margin: 24px 0 0 20px; | ||
position: absolute; | ||
} |