time input
This commit is contained in:
parent
e95d240562
commit
f480578520
4 changed files with 37 additions and 36 deletions
|
|
@ -7,7 +7,7 @@ class PlaceInput {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const placeInput = document.createElement('textarea');
|
const placeInput = document.createElement('textarea');
|
||||||
placeInput.id = 'place-input';
|
placeInput.id = this.id;
|
||||||
placeInput.className = 'place-and-time-box';
|
placeInput.className = 'place-and-time-box';
|
||||||
placeInput.autocomplete = 'on';
|
placeInput.autocomplete = 'on';
|
||||||
placeInput.maxLength = 140;
|
placeInput.maxLength = 140;
|
||||||
|
|
|
||||||
26
src/front/components/TimeInput.js
Normal file
26
src/front/components/TimeInput.js
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
class TimeInput {
|
||||||
|
constructor({ parentElement, id }) {
|
||||||
|
this.element = null;
|
||||||
|
this.parentElement = parentElement;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const timeInput = document.createElement('textarea');
|
||||||
|
timeInput.id = this.id;
|
||||||
|
timeInput.className = 'place-and-time-box';
|
||||||
|
timeInput.autocomplete = 'on';
|
||||||
|
timeInput.maxLength = 140;
|
||||||
|
timeInput.placeholder =
|
||||||
|
'¿Cuándo? Ej."Cualquier hora", "19:00-21:00", "Finde"';
|
||||||
|
|
||||||
|
this.element = timeInput;
|
||||||
|
this.parentElement.appendChild(this.element);
|
||||||
|
}
|
||||||
|
|
||||||
|
get inputText() {
|
||||||
|
return this.element.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = TimeInput;
|
||||||
|
|
@ -3,31 +3,8 @@ const BuyOrSellButtonGroup = require('../components/BuyOrSellButtonGroup');
|
||||||
const PremiumSelector = require('../components/PremiumSelector');
|
const PremiumSelector = require('../components/PremiumSelector');
|
||||||
const PriceDisplay = require('../components/PriceDisplay');
|
const PriceDisplay = require('../components/PriceDisplay');
|
||||||
const AmountInput = require('../components/AmountInput');
|
const AmountInput = require('../components/AmountInput');
|
||||||
|
const PlaceInput = require('../components/PlaceInput');
|
||||||
class PlaceInput {
|
const TimeInput = require('../components/TimeInput');
|
||||||
constructor({ parentElement, id }) {
|
|
||||||
this.element = null;
|
|
||||||
this.parentElement = parentElement;
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const placeInput = document.createElement('textarea');
|
|
||||||
placeInput.id = 'place-input';
|
|
||||||
placeInput.className = 'place-and-time-box';
|
|
||||||
placeInput.autocomplete = 'on';
|
|
||||||
placeInput.maxLength = 140;
|
|
||||||
placeInput.placeholder =
|
|
||||||
"¿Dónde? Ej.'Eixample', 'La Maquinista', 'Cualquier lugar en BCN', 'Meetup BBO'";
|
|
||||||
|
|
||||||
this.element = placeInput;
|
|
||||||
this.parentElement.appendChild(this.element);
|
|
||||||
}
|
|
||||||
|
|
||||||
get inputText() {
|
|
||||||
return this.element.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function offersPage() {
|
function offersPage() {
|
||||||
const createOfferEventBus = new EventTarget();
|
const createOfferEventBus = new EventTarget();
|
||||||
|
|
@ -86,6 +63,13 @@ function offersPage() {
|
||||||
});
|
});
|
||||||
|
|
||||||
placeInput.render();
|
placeInput.render();
|
||||||
|
|
||||||
|
const timeInput = new TimeInput({
|
||||||
|
parentElement: document.getElementById('place-and-time-boxes'),
|
||||||
|
id: 'time-input',
|
||||||
|
});
|
||||||
|
|
||||||
|
timeInput.render();
|
||||||
// -----------
|
// -----------
|
||||||
const navbuttonHome = document.getElementById('navbutton-home');
|
const navbuttonHome = document.getElementById('navbutton-home');
|
||||||
const navbuttonOffers = document.getElementById('navbutton-offers');
|
const navbuttonOffers = document.getElementById('navbutton-offers');
|
||||||
|
|
@ -108,8 +92,6 @@ function offersPage() {
|
||||||
);
|
);
|
||||||
const viewMyOffersRoot = document.getElementById('view-my-offers-root');
|
const viewMyOffersRoot = document.getElementById('view-my-offers-root');
|
||||||
|
|
||||||
const timeInput = document.getElementById('time-input');
|
|
||||||
|
|
||||||
const onchainCheckbox = document.getElementById('onchain-checkbox');
|
const onchainCheckbox = document.getElementById('onchain-checkbox');
|
||||||
const lightningCheckbox = document.getElementById('lightning-checkbox');
|
const lightningCheckbox = document.getElementById('lightning-checkbox');
|
||||||
|
|
||||||
|
|
@ -172,7 +154,7 @@ function offersPage() {
|
||||||
const premium = premiumSelector.getPremium();
|
const premium = premiumSelector.getPremium();
|
||||||
const trade_amount_eur = amountInput.intEurAmount;
|
const trade_amount_eur = amountInput.intEurAmount;
|
||||||
const location_details = placeInput.inputText;
|
const location_details = placeInput.inputText;
|
||||||
const time_availability_details = timeInput.value;
|
const time_availability_details = timeInput.inputText;
|
||||||
const is_onchain_accepted = onchainCheckbox.checked;
|
const is_onchain_accepted = onchainCheckbox.checked;
|
||||||
const is_lightning_accepted = lightningCheckbox.checked;
|
const is_lightning_accepted = lightningCheckbox.checked;
|
||||||
const show_offer_to_trusted = myTrustedCheckbox.checked;
|
const show_offer_to_trusted = myTrustedCheckbox.checked;
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,6 @@
|
||||||
<div id="place-and-time-area" class="create-offer-step">
|
<div id="place-and-time-area" class="create-offer-step">
|
||||||
<h3>¿Dónde y cuándo?</h3>
|
<h3>¿Dónde y cuándo?</h3>
|
||||||
<div id="place-and-time-boxes">
|
<div id="place-and-time-boxes">
|
||||||
<textarea
|
|
||||||
id="time-input"
|
|
||||||
class="place-and-time-box"
|
|
||||||
autocomplete="on"
|
|
||||||
maxlength="140"
|
|
||||||
placeholder='¿Cuándo? Ej."Cualquier hora", "19:00-21:00", "Finde"'
|
|
||||||
></textarea>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="bitcoin-methods-area" class="create-offer-step">
|
<div id="bitcoin-methods-area" class="create-offer-step">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue