button group and default value

This commit is contained in:
counterweight 2025-02-22 02:18:23 +01:00
parent 77785a2104
commit e6e2f42f86
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 54 additions and 9 deletions

View file

@ -27,6 +27,39 @@ h1 {
.clickable {
cursor: pointer;
}
.button-group button {
border: 0;
padding: 1em;
cursor: pointer;
}
.button-group button.selected {
border: 0;
padding: 1em;
background: #e1c300;
}
.button-group button.unselected {
border: 0;
padding: 1em;
background: #e1c300;
font-weight: bold;
color: white;
}
.button-group button:first-of-type {
border-top-left-radius: 1em;
border-bottom-left-radius: 1em;
margin-right: 0;
}
.button-group button:last-of-type {
border-top-right-radius: 1em;
border-bottom-right-radius: 1em;
margin-left: 0;
}
.over-background {
background-color: white;
border-radius: 1vw;

View file

@ -4,6 +4,17 @@ const buttonStartCreateOffer = document.getElementById(
const closeOfferControls = document.getElementById('close-order-controls-x');
const createOfferControls = document.getElementById('create-offer-controls');
const buyOrSellButtonGroup = document.getElementById(
'button-group-buy-or-sell'
);
const buyOrSellButtons = buyOrSellButtonGroup.querySelectorAll('button');
function toggleCreateOfferControls() {
createOfferControls.style.display =
createOfferControls.style.display === 'block' ? 'none' : 'block';
buttonStartCreateOffer.disabled = !buttonStartCreateOffer.disabled;
}
buttonStartCreateOffer.addEventListener('click', () => {
toggleCreateOfferControls();
});
@ -11,9 +22,3 @@ buttonStartCreateOffer.addEventListener('click', () => {
closeOfferControls.addEventListener('click', () => {
toggleCreateOfferControls();
});
function toggleCreateOfferControls() {
createOfferControls.style.display =
createOfferControls.style.display === 'block' ? 'none' : 'block';
buttonStartCreateOffer.disabled = !buttonStartCreateOffer.disabled;
}