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

DOM-api-task #442

Merged
merged 3 commits into from
Sep 23, 2022
Merged

Conversation

Conversee12
Copy link
Contributor

DOM-api-task

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@Conversee12 Conversee12 changed the title uploaded files task_DOM DOM-api-task Sep 5, 2022
@github-actions
Copy link

github-actions bot commented Sep 5, 2022

Hey!

Congratulations on your PR! 😎😎😎

Let's do some self-checks to fix most common issues and to make some improvements to the code before reviewers put their hands on the code.

Go through the requirements/most common mistakes listed/linked below and fix the code as appropriate.

If you have any questions to requirements/common mistakes feel free asking them here or in Students' chat.

When you genuinely believe you are done put a comment stating that you have completed self-checks and fixed code accordingly.

Also, be aware, that if you would silently ignore this recommendation, a mentor can think that you are still working on fixes. And your PR will not be reviewed. 😒

Please, make sure you haven't made common mistakes

Universal recommendations:

  • Give variables and functions meaningful names. Avoid generic names like item, element, key, object, array or their variations. Exception: helper functions that are specifically and intentionally designed to be multipurpose.
  • Function names should start with a verb as they denote actions; variables are normally nouns; boolean variables/functions start with is, does, has etc; variable containing multiple entities and functions returning lists contain entity name in plural form.
  • Have consistent code style and formatting. Employ Prettier to do all dirty work for you.
  • Use common sense or seek for an advice whenever requirements look ambiguous or unclear.

Also take a note of the requirements above and follow them in all your future projects.

By the way, you may proceed to the next task before this one is reviewed and merged.

Sincerely yours,
Submissions Kottachecker 😺

@Conversee12
Copy link
Contributor Author

I've completed self-checks, did'nt find any common errors

@lysenko-sergey-developer

@Conversee12 Good work! 👍

return rockBands.forEach((band) => {
const { title } = band;
const button = document.createElement("button");
button.classList.add("buttons");

Choose a reason for hiding this comment

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

Why class is buttons for a single button?

<section class="container">
<h2 class="section__title"></h2>
<div class="container__image-text">
<img src="" alt="" class="section__img">

Choose a reason for hiding this comment

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

img must have not emptyalt attribute.


function showMain(target) {
const content = rockBands.filter(
(band) => target.innerText === band.title

Choose a reason for hiding this comment

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

Searching by title is a bad idea. Add ids.

}

function showMain(target) {
const content = rockBands.filter(

Choose a reason for hiding this comment

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

Looks like find is more right choice in your situation.

}

const sideBar = document.querySelector(".sideBar");
initButtons(sideBar);

Choose a reason for hiding this comment

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

You use sideBar only inside initButtons and initButtons call only once. You can move sideBar into initButtons.

body {
display: flex;
flex-direction: column;
background: #0b0e14;

Choose a reason for hiding this comment

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

Move colors to css3 vars.

@Conversee12
Copy link
Contributor Author

Okey, i fixed it, but I didn't understand why (.find) is better here, please explain whether it still needs to be replaced.

@lysenko-sergey-developer

In showMenu with filter, you extract one rock-group and destruct first element of array to object properties. If you will use find you will have one element as result and you don't need to use array destruct.

button.classList.add("button");
button.id = id;
button.innerText = title;
button.addEventListener("click", ({ target }) => {

Choose a reason for hiding this comment

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

Can we use event bubbling for use single event handler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yee, i finally understand the difference between filter and find, thanks

Copy link

@lysenko-sergey-developer lysenko-sergey-developer left a comment

Choose a reason for hiding this comment

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

LGTM! 😸

@lysenko-sergey-developer lysenko-sergey-developer merged commit d06c1a8 into kottans:main Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants