move to different file
This commit is contained in:
parent
c82fc895b7
commit
47c50ad078
2 changed files with 22 additions and 20 deletions
21
src/front/components/PublishOfferButton.js
Normal file
21
src/front/components/PublishOfferButton.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
class PublishOfferButton {
|
||||||
|
constructor({ parentElement, id, onClickCallback }) {
|
||||||
|
this.element = null;
|
||||||
|
this.parentElement = parentElement;
|
||||||
|
this.id = id;
|
||||||
|
this.onClickCallback = onClickCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const button = document.createElement('button');
|
||||||
|
button.id = this.id;
|
||||||
|
button.className = 'button-primary button-large';
|
||||||
|
button.innerText = 'Publicar oferta';
|
||||||
|
button.addEventListener('click', this.onClickCallback);
|
||||||
|
|
||||||
|
this.element = button;
|
||||||
|
this.parentElement.appendChild(this.element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = PublishOfferButton;
|
||||||
|
|
@ -1,24 +1,5 @@
|
||||||
const formatNumberWithSpaces = require('../utils/formatNumbersWithSpaces');
|
const formatNumberWithSpaces = require('../utils/formatNumbersWithSpaces');
|
||||||
|
const PublishOfferButton = require('../components/PublishOfferButton');
|
||||||
class PublishOfferButton {
|
|
||||||
constructor({ parentElement, id, onClickCallback }) {
|
|
||||||
this.element = null;
|
|
||||||
this.parentElement = parentElement;
|
|
||||||
this.id = id;
|
|
||||||
this.onClickCallback = onClickCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const button = document.createElement('button');
|
|
||||||
button.id = this.id;
|
|
||||||
button.className = 'button-primary button-large';
|
|
||||||
button.innerText = 'Publicar oferta';
|
|
||||||
button.addEventListener('click', this.onClickCallback);
|
|
||||||
|
|
||||||
this.element = button;
|
|
||||||
this.parentElement.appendChild(this.element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function offersPage() {
|
function offersPage() {
|
||||||
const publishOfferButton = new PublishOfferButton({
|
const publishOfferButton = new PublishOfferButton({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue