diff --git a/templates/collection_modal.templ b/templates/collection_modal.templ index 43830ea..39fd2c1 100644 --- a/templates/collection_modal.templ +++ b/templates/collection_modal.templ @@ -52,8 +52,8 @@ templ CollectionModal(collection CollectionData) { class="input mb-2" placeholder="Search or type emoji..." maxlength="4" - oninput="filterIcons(this.value)" - onfocus="showAllIcons()" + @input="filterIcons($event.target.value)" + @focus="showAllIcons()" />
- - - - - + + + + +
@@ -110,8 +110,8 @@ templ CollectionModal(collection CollectionData) { class="input mb-2" placeholder="Search or type emoji..." maxlength="4" - oninput="filterIcons(this.value)" - onfocus="showAllIcons()" + @input="filterIcons($event.target.value)" + @focus="showAllIcons()" />
- - - - - + + + + +
diff --git a/templates/collection_modal_templ.go b/templates/collection_modal_templ.go index d347c51..3a360b7 100644 --- a/templates/collection_modal_templ.go +++ b/templates/collection_modal_templ.go @@ -117,7 +117,7 @@ func CollectionModal(collection CollectionData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/web/src/collections.ts b/web/src/collections.ts index d9a7c40..12dfecf 100644 --- a/web/src/collections.ts +++ b/web/src/collections.ts @@ -363,7 +363,7 @@ function selectColor(color: string): void { (btn as HTMLElement).style.outlineOffset = "0"; }); const selectedBtn = document.querySelector( - `.color-option[onclick="selectColor('${color}')"]`, + `.color-option[data-color="${color}"]`, ) as HTMLElement; if (selectedBtn) { selectedBtn.style.outline = "3px solid var(--text-primary)"; @@ -402,6 +402,7 @@ function setupHTMXModalInit(): void { const target = evt.detail.target; if (target && target.id === "modal-container") { populateIconGrid(); + initColorSelection(); Alpine.initTree(target); } if (target && target.id === "book-picker-grid") { @@ -473,8 +474,9 @@ function populateIconGrid(): void { button.type = "button"; button.className = "icon-btn text-2xl p-1 hover:bg-opacity-80 rounded"; button.textContent = emoji; - button.setAttribute("onclick", `selectIcon('${emoji}')`); + button.setAttribute("data-emoji", emoji); button.setAttribute("data-keywords", keywords.join(",")); + button.addEventListener("click", () => selectIcon(emoji)); iconGrid.appendChild(button); }); } @@ -496,7 +498,7 @@ function selectIcon(icon: string): void { }); const selectedBtn = document.querySelector( - `.icon-btn[onclick="selectIcon('${icon}')"]`, + `.icon-btn[data-emoji="${icon}"]`, ) as HTMLElement; if (selectedBtn) { selectedBtn.style.outline = "2px solid var(--text-primary)";