function dropdownButton(buttonName, content) {
function toggleDropdown() {
const dropdown = document.getElementById("dropdownContent");
if (dropdown.style.display === "none" || dropdown.style.display === "") {
dropdown.style.display = "block";
document.body.addEventListener('click', closeDropdownOnClickOutside);
} else {
dropdown.style.display = "none";
document.body.removeEventListener('click', closeDropdownOnClickOutside);
}
}
function closeDropdownOnClickOutside(event) {
const dropdown = document.getElementById("dropdownContent");
const button = document.querySelector('.dropbtn');
if (!dropdown.contains(event.target) && event.target !== button) {
dropdown.style.display = "none";
document.body.removeEventListener('click', closeDropdownOnClickOutside);
}
}
const dropdownButton = htl.html`
<div class='dropdown'>
<button onclick=${toggleDropdown} class="dropbtn" style='height:30px;width:200px;padding:4px 2px;background-color:white;border:1px #ccc solid;border-radius:2px;'>${buttonName}</button>
<div class='dropdown-content' id='dropdownContent' style='position:absolute;z-index:2000;background-color:white;padding:5px 0px;display:none;width:200px;border-radius:2px;box-shadow:0 6px 12px rgba(0,0,0,.175);margin-top:5px;'>
<div style='margin:10px 5px;' class='inner-content'>${content}</div>
</div>
</div>`
return dropdownButton}