Extract FormatNumber Hook

This commit is contained in:
Claudio Ortolina
2025-09-17 09:02:09 +03:00
parent 6112ec7f0a
commit fa1a8bee54
3 changed files with 11 additions and 11 deletions
@@ -78,17 +78,7 @@ defmodule MusicLibraryWeb.StatsComponents do
<dd :if={@tooltip} class="mt-1">
<.tooltip>
<:content>
<script :type={Phoenix.LiveView.ColocatedHook} name=".FormatNumber">
export default {
mounted() {
this.el.innerText = parseInt(this.el.innerText).toLocaleString();
},
updated() {
this.el.innerText = parseInt(this.el.innerText).toLocaleString();
}
}
</script>
<span id={"#{@title}-counter-tooltip"} phx-hook=".FormatNumber">{@tooltip}</span>
<span id={"#{@title}-counter-tooltip"} phx-hook="FormatNumber">{@tooltip}</span>
</:content>
<.link
:if={@path}