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 task #389

Merged
merged 3 commits into from
Sep 15, 2022
Merged

Dom task #389

merged 3 commits into from
Sep 15, 2022

Conversation

nvklap
Copy link
Contributor

@nvklap nvklap commented Sep 1, 2022

Dom api task

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 1, 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 😺

@nvklap
Copy link
Contributor Author

nvklap commented Sep 2, 2022

I've completed self-checks.

@lysenko-sergey-developer
Copy link

lysenko-sergey-developer commented Sep 13, 2022

@nvklap Awesome work 🚀

@@ -0,0 +1,242 @@
@font-face {
font-family: 'Veteran Typewriter';
src: url('../fonts/veteran\ typewriter.ttf') format('truetype');
Copy link

Choose a reason for hiding this comment

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

Avoid dividing file names by space. Use next variants: veteran-typewriter.ttf or veteran_typewriter.ttf

}

.header {
background-color: #9b011b;

Choose a reason for hiding this comment

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

Try to use CSS3 Vars for keeping your colours in one place. This is good practice handling colours/typography in one place.

https://www.w3schools.com/css/css3_variables.asp

}

.content-figure {
margin: -10px -10px 10px;

Choose a reason for hiding this comment

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

Try to avoid using negative margins. Negative margins are a lazy way solution. In your case, you can remove the margin from .content-figure, remove padding for .content and add a new wrapper for inner content excluding .content-figure which will have padding: 10px;

@@ -0,0 +1,401 @@
const taskmasterData = [
{
id: 0,

Choose a reason for hiding this comment

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

Don't be afraid to separate data if it will simplify the logic. In your case, if you move zero seria to independent object initTaskmasterData you will remove all checks related to initSeriesId

}

function createContentImg(src, alt) {
img = document.createElement('img');

Choose a reason for hiding this comment

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

Missing const keyword

function createContentHeading(tag, className, text) {
const heading = document.createElement(tag);
heading.classList.add(className);
heading.innerText = text;

Choose a reason for hiding this comment

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

Prefer textContent over innerText when you alting text node.

@lysenko-sergey-developer

UI/UX Improvement:
Content reflow while image loading
The Complete Guide to Lazy Loading Images | CSS-Tricks

  • change max-width to width on img
  • add aspect-ratio with a value which your image has
    Screenshot 2022-09-13 at 19 41 58

@nvklap
Copy link
Contributor Author

nvklap commented Sep 14, 2022

Thanks a lot for review and useful advise! I've fixed my code.

const navWrapper = document.querySelector('.series-nav');
const contentWrapper = document.querySelector('.content');
const btnMore = document.querySelector('.btn-more');
const initSeriesId = 0;
Copy link

Choose a reason for hiding this comment

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

Perhaps you forget to remove initSeriesId and filtering related to it.

addNavigation(taskmasterData);
initContent(contentWrapper, initTaskmasterData);

const navList = document.querySelector('.series-list');

Choose a reason for hiding this comment

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

Move navList to other selectors.

addTemplateToDom(parent, htmlTemplate);
}

function showContent({ target }) {

Choose a reason for hiding this comment

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

addNavigation, createContentList and showContent do too much stuff. Try to decompose them into smaller functions.

@lysenko-sergey-developer

LGTM! 😃

@OleksiyRudenko OleksiyRudenko merged commit e0e2b6d into kottans:main Sep 15, 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