move to different file

This commit is contained in:
counterweight 2025-03-15 15:28:44 +01:00
parent c82fc895b7
commit 47c50ad078
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 22 additions and 20 deletions

View 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;

View file

@ -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({