From 5ef05a94f5927da0e5a230be61c8de81a05f8819 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Wed, 19 Feb 2025 09:49:05 +0000 Subject: [PATCH] Move badge/1 to core components --- .../components/core_components.ex | 49 +++++++++++++++++++ .../live/stats_live/data_components.ex | 49 ------------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/lib/music_library_web/components/core_components.ex b/lib/music_library_web/components/core_components.ex index 3684454d..6c9a5113 100644 --- a/lib/music_library_web/components/core_components.ex +++ b/lib/music_library_web/components/core_components.ex @@ -642,6 +642,55 @@ defmodule MusicLibraryWeb.CoreComponents do """ end + attr :color, :atom, values: [:green, :yellow, :gray], required: true + attr :text, :string, required: true + + def badge(assigns) do + case assigns.color do + :green -> + ~H""" + + {@text} + + """ + + :yellow -> + ~H""" + + {@text} + + """ + + :gray -> + ~H""" + + {@text} + + """ + end + end + ## JS Commands def show(js \\ %JS{}, selector) do diff --git a/lib/music_library_web/live/stats_live/data_components.ex b/lib/music_library_web/live/stats_live/data_components.ex index f2c96965..5aae9624 100644 --- a/lib/music_library_web/live/stats_live/data_components.ex +++ b/lib/music_library_web/live/stats_live/data_components.ex @@ -65,53 +65,4 @@ defmodule MusicLibraryWeb.StatsLive.DataComponents do """ end - - attr :color, :atom, values: [:green, :yellow, :gray], required: true - attr :text, :string, required: true - - def badge(assigns) do - case assigns.color do - :green -> - ~H""" - - {@text} - - """ - - :yellow -> - ~H""" - - {@text} - - """ - - :gray -> - ~H""" - - {@text} - - """ - end - end end