-
Notifications
You must be signed in to change notification settings - Fork 0
phoneApp с помощью innerHtml #17
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
base: master
Are you sure you want to change the base?
Conversation
phoneApp/js/main.js
Outdated
| ${this.colums.map(colum => {return`<th>${colum}</th>`}).join('')} | ||
| </thead> | ||
| <tbody> | ||
| ${this.users.map(user => {return` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can omit return word it will look more harmonious
phoneApp/js/main.js
Outdated
| </form> | ||
| <table class="table table-hover contacts"> | ||
| <thead> | ||
| ${this.colums.map(colum => {return`<th>${colum}</th>`}).join('')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same about return keyword
phoneApp/js/main.js
Outdated
| <footer class="footer"> | ||
| <div class="container bottom-radius"> | ||
| <nav class="main-nav"> | ||
| <a href="index.html" class="tab active"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you could make links more reusable.
What if one day you have to set class but the click ? or something more expensive.
I guess it could look that way
<nav class="main-nav">
this.renderLink({ content:'Contacts', className:'active', icon:'search'});
this.renderLink({ content:'Keypad', icon:'th'});
this.renderLink({ content:'Edit contact' });
...
</nav>We could reuse some HTML parts and create a smaller reusable blocks
phoneApp/js/main.js
Outdated
| }, | ||
| ]; | ||
| const colums = ['Name', 'LastName', 'Email']; | ||
| const app = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make app a class with ContactPage name
phoneApp/js/main.js
Outdated
| users, | ||
| colums, | ||
| render() { | ||
| document.body.innerHTML += this.renderHeader() +this.renderMain() + this.renderFooter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const contactPageLayot = this.renderHeader() +this.renderMain() + this.renderFooter();
document.body.innerHTML not sure I like to use document.body.
You have to create an additional tag at index.html and call it, for example,
<div id="mountNode"></div>And update content only inside such node. updating the whole document.body is too risky
phoneApp/js/keypad.js
Outdated
|
|
||
| } | ||
| render() { | ||
| const mountNode = document.createElement('div'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to create such elements in JS :) add it to html file is fine
phoneApp/js/keypad.js
Outdated
| render() { | ||
| const mountNode = document.createElement('div'); | ||
| mountNode.setAttribute('id', 'mountNode'); | ||
| mountNode.innerHTML += this.renderHeader() +this.renderMain() + this.renderFooter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you know... if we just could add "html-layout" without method dividings it could be more informative that
renderHeader + remderMain + renderFooter
…строка, получаеться я хочу получить юзеров, которых еще не успела записать
No description provided.