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

My PR width DOM-api #400

Merged
merged 6 commits into from
Sep 17, 2022
Merged

Conversation

Nik3264
Copy link
Contributor

@Nik3264 Nik3264 commented Sep 2, 2022

Document Object Model

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@github-actions
Copy link

github-actions bot commented Sep 2, 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 😺

@Nik3264
Copy link
Contributor Author

Nik3264 commented Sep 2, 2022

I completed the self-test. I don't know what's wrong here. Perhaps I misunderstood the problem. I will be glad to receive recommendations on my mistakes in order to avoid them in the future. Thanks.

@Nik3264
Copy link
Contributor Author

Nik3264 commented Sep 4, 2022

Please, review.

@lysenko-sergey-developer

@Nik3264 Good work!🥇

submissions/Nik3264/js-dom/index.js Outdated Show resolved Hide resolved
submissions/Nik3264/js-dom/index.js Outdated Show resolved Hide resolved
submissions/Nik3264/js-dom/index.js Outdated Show resolved Hide resolved
submissions/Nik3264/js-dom/index.js Outdated Show resolved Hide resolved
submissions/Nik3264/js-dom/index.js Outdated Show resolved Hide resolved
submissions/Nik3264/js-dom/index.js Outdated Show resolved Hide resolved
</nav>
<div class="content">
<div class="item">

Choose a reason for hiding this comment

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

A redundant empty line. Configure your code editor to see redundant space/tabs/empty lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I configured my code with Prettier.

Choose a reason for hiding this comment

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

@lysenko-sergey-developer

UI/UX Improvements:

  1. Work on your mobile version.
  2. Change styles for item title header. There is too much space between header and image.
  3. Blinking animation for content is not the best choice. Try to play with another animation or just remove it.
    Screenshot 2022-09-14 at 23 59 39

…space between header and img, added function render, renamed array
@Nik3264
Copy link
Contributor Author

Nik3264 commented Sep 15, 2022

I removed blinking animation, reduced the space between header and image with media-query. I am not sure whether it was exactly that what I had to do.
Thank you for all your comments. I tried my best to correct my mistakes ))

@lysenko-sergey-developer

Good work! Let's try to put a cherry on the cake :)

</nav>
<div class="content">
<div class="item">

Choose a reason for hiding this comment

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

}

:root {
--color-header: #8d7361;

Choose a reason for hiding this comment

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

Bad naming for colours. Remove color prefix and colour must mean colour. Like space-grey, lime-green, hot-pink or just white.

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

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>

Choose a reason for hiding this comment

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

Change the title name to something more appropriate for this page

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

<main class="wrap">
<nav class="menu">
<div class="menu__item">Led Zeppelin</div>
<div class="menu__item menu__item__active">Beatles</div>

Choose a reason for hiding this comment

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

Beatles has menu__item__active by default but after script is inited its flushed.

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 missed this. At first I tried this in the html, and then through the function in js. And I forgot to delete it in html ))

);
}

hideMenuItemsActive();

Choose a reason for hiding this comment

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

If you will don't have any menu items with menu__item__active on init, you will not need to call this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was a test run, already removed ))

renderContent(0, contentItem);

menu.addEventListener("click", (event) => {
event.preventDefault();

Choose a reason for hiding this comment

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

Write why you using preventDefault and stopPropagation in this event listener.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
On mobile, when tapping on the menu, a blue highlight appeared, I have not noticed before. But now I've decided to remove it. The search for this bug was longer in time. I tried everything to somehow intercept the event and process it specifically on the target, and not affect the menu. But the solution turned out to be simple. Now I know it))). But of course, I forgot to remove everything unnecessary. It's because of the rush, I'm trying to move on as quickly as possible))


const menuItem = document.querySelectorAll(".menu__item"),
menu = document.querySelector(".menu"),
contentItem = document.querySelector(".item");

Choose a reason for hiding this comment

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

item is bad naming for this class

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 have renamed on to group-info, and all following classes are group-info__header, group-info__src, etc..
Can it be like that?

paragraph = document.createElement("p");

parent.innerHTML = "";
parent.appendChild(

Choose a reason for hiding this comment

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

appendChild support appending multiple nodes by one call

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 replaced appendChild for append, and now appending all nodes with one call. AppendChild does not allow this, at least I did not find it in the documentation. But I did know the difference between append and appendChild ))

console.log(event.target);
const target = event.target;

if (target && target.classList.contains("menu__item")) {

Choose a reason for hiding this comment

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

In which case you will not have event.target?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is always a target when a click occurs. Here the condition is redundant. in my opinion. I correct it
if (target.classList.contains("menu__item"))

--color-yellow: #c9bbae;
}

@keyframes fade {

Choose a reason for hiding this comment

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

Drop this animation fade and fade-text. If you want cool animation for this block. Try to implement fade which will be fading by vertical or "fade down".

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'm stuck on this animation. It would be easier to remove it immediately. And spend more time on the code)))
To be honest, I like learning js more than css.

Choose a reason for hiding this comment

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

I forgot about this one. Change translateX(100px); to translateY(-25px); and opacity: 0; to opacity: 0.75; Don't forget about 100% step of animation there translateX replace to 'translateY`

@lysenko-sergey-developer

UI/UX Improvements:

  1. Fade still exist. Try to replace it with 'fade down' or vertical fade.
  2. White space on the bottom. Remove it.
  3. Mobile version still looks bad :( I recommend adding a hamburger menu variation for the mobile version.
    Screenshot 2022-09-15 at 22 42 53

.group-info__text {
flex-grow: 2;
font-size: 1.5em;
animation: fade-text 0.85s ease-out;

Choose a reason for hiding this comment

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

OK, let's correct this. Change to
fade-text 0.7s ease-out;

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

text-transform: uppercase;
margin-bottom: 25px;
text-shadow: 2px 2px 2px var(--grey-blue);
animation: fade-text 0.5s ease-out;

Choose a reason for hiding this comment

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

OK, let's correct this. Change to
fade-text 0.7s ease-out;

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

margin-right: 20%;
border-radius: 2%;
box-shadow: 5px 15px 10px 3px;
animation: fade 0.7s;

Choose a reason for hiding this comment

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

OK, let's correct this. Change to
fade 0.7s ease-out;

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

0% {
transform: translateY(-50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 100%);

Choose a reason for hiding this comment

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

Remove clip-path.
Change translateY(-50px); to translateY(-25px);
Change opacity: 0; to opacity: 0.75;

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

clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 100%);
}
100% {
transform: translateY(0);

Choose a reason for hiding this comment

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

Remove clip-path.

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

}
}

@media screen and (max-width: 480px) {

Choose a reason for hiding this comment

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

Mobile version should start from 768px

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

@lysenko-sergey-developer
Copy link

lysenko-sergey-developer commented Sep 17, 2022

@Nik3264 Looks like need one small fix to image animation and we did it!

@Nik3264
Copy link
Contributor Author

Nik3264 commented Sep 17, 2022

Thanks for your time spent for me! I feel like I still have a lot to learn. But this practice is much more than just reading documentation. I really appreciate this!

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
Copy link

lysenko-sergey-developer commented Sep 17, 2022

@Nik3264 Congratulation! You really did a lot! I enjoyed your final page variant, so cool!

@lysenko-sergey-developer lysenko-sergey-developer merged commit d3d37e9 into kottans:main Sep 17, 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.

4 participants