Skip to content

accidentally closed the previous pull request #29

Open
KateMhq wants to merge 19 commits into
constructorlabs:masterfrom
KateMhq:master
Open

accidentally closed the previous pull request #29
KateMhq wants to merge 19 commits into
constructorlabs:masterfrom
KateMhq:master

Conversation

@KateMhq
Copy link
Copy Markdown

@KateMhq KateMhq commented Sep 24, 2018

No description provided.

Comment thread favorite.html
</head>
<body>
<h1>My Favorites</h1>
<!-- <form class="search-area">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Commented out code can be removed

Comment thread movie.js
//this is to insert search results using dom
function searchResult(body) {
body.Search.forEach(movie => {
let searchResultContainer = document.createElement("li");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It might be easier to create elements using HTML string templates rather than using createElement for each item

Comment thread movie.js

let favorite = document.createElement("button");
favorite.innerHTML = "Add to favorites";
favorite.addEventListener("click", function(event) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be better to use event delegation. Let the events bubble up and handle them in one place rather than place place event handlers on elements individually

Comment thread movie.js
});
}

searchSubmit.addEventListener("click", function(event) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We want to listen for a submit event on the form rather than a click on submit button

Comment thread movie.js
.then(response => response.json())
.then(body => {
if (typeof body.Search !== "undefined") {
let arr=body.Search;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

there is a fair bit of code duplication here. We could instead use a loop here to perform same task 3 times

Comment thread style.css
}


.search-area{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would have been great to see more BEM style CSS selectors in use

Comment thread style.css


.search-area{
display: grid;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Love seeing grid being used :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants