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

Vlad dom #29

Merged
merged 8 commits into from
Aug 2, 2022
Merged

Vlad dom #29

merged 8 commits into from
Aug 2, 2022

Conversation

Pozzitive11
Copy link
Contributor

dom-js

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

Copy link

@al0tak al0tak left a comment

Choose a reason for hiding this comment

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

Hi! Nice work!

There is a little problem with mobile view - hamburger menu button overlaps with header (see screenshot). It would be nice to move some thing around, so they are placed better.

image

Also, check comments below.


function createNavList(photos) {
let btns = photos.map(({ name, img, id }) => createBtn(name, img, id));
let navList = document.querySelector(".nav__list");
Copy link

Choose a reason for hiding this comment

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

const navList and const btns

</li>`;
};

function createNavList(photos) {
Copy link

Choose a reason for hiding this comment

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

Is there a reasong for this function to exist? It seems like the only time you use it is right after you define it and that's it.

};
fillContent(photos[0]);

const navList = document.querySelector(".nav__list");
Copy link

Choose a reason for hiding this comment

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

You already got navList in the function createNavList. If you could just place createNavList code outside the function scope, you would already have this variable.


const navList = document.querySelector(".nav__list");

navList.addEventListener("click", (event) => {
Copy link

Choose a reason for hiding this comment

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

You are not using event anywhere except the next line, it makes sence to desctruct it and just get {target} as a function argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i.e. do like this?
image

Copy link

Choose a reason for hiding this comment

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

What I meant is that you can recieve { target } in the functions arguments, instead of event. This will extract target value from the incoming event argument and establish it as local value. You will not need to use event.target each time you need it after these changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done 😃

const target = event.target;
if (target && target.classList.contains("nav__btn")) {
let photoId = target.id;
let photoItem = photos.find((item) => item.id === photoId);
Copy link

Choose a reason for hiding this comment

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

const

@Pozzitive11 Pozzitive11 requested a review from al0tak July 30, 2022 20:10
<img class="photo-img" src="img/mystical-mountain.jpg" alt="">
</div>
<figcaption>
<div class="photo__name"></div>
Copy link

Choose a reason for hiding this comment

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

This probably should be a h2 tag with a page title, not a photo description.

@al0tak
Copy link

al0tak commented Aug 2, 2022

Well done!

@al0tak al0tak merged commit 31b04cc into kottans:main Aug 2, 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