* HM-28 Добавил компонент таблицы
This commit is contained in:
mrPadre
2020-07-14 12:40:06 +03:00
committed by GitHub
parent b17313dbf6
commit 521a80c1e3
15 changed files with 186 additions and 6 deletions

View File

@ -0,0 +1,25 @@
import Component from '../component/index';
class TableRowComponent extends Component {
constructor (container, object, index) {
super('#table-row', container);
this.row = this.mainNode;
this.indexPlace = this.mainNode.querySelector('.Body__row-index');
this.content = Object.values(object);
this.indexPlace.textContent = index + 1;
this.content.forEach((text) => {
const contentPlace = document.createElement('td');
contentPlace.textContent = typeof(text) !== 'string' ? typeof(text) : text;
this.row.appendChild(contentPlace);
});
this.addEventListener(this.mainNode, 'click', (evt) => {
this.next('click', evt);
});
}
}
export default TableRowComponent;