diff --git a/lib/music_library_web/components/core_components.ex b/lib/music_library_web/components/core_components.ex index 9aff6c4e..db11e5f6 100644 --- a/lib/music_library_web/components/core_components.ex +++ b/lib/music_library_web/components/core_components.ex @@ -41,7 +41,7 @@ defmodule MusicLibraryWeb.CoreComponents do attr :id, :string, doc: "the optional id of flash container" attr :flash, :map, default: %{}, doc: "the map of flash messages to display" attr :title, :string, default: nil - attr :kind, :atom, values: [:info, :error], doc: "used for styling and flash lookup" + attr :kind, :atom, values: [:info, :warning, :error], doc: "used for styling and flash lookup" attr :rest, :global, doc: "the arbitrary HTML attributes to add to the flash container" slot :inner_block, doc: "the optional inner block that renders the flash message" @@ -59,6 +59,8 @@ defmodule MusicLibraryWeb.CoreComponents do "fixed top-2 right-2 mr-2 w-80 sm:w-96 z-50 rounded-md shadow-md p-3 ring-1 ring-zinc-400 border-l-2", @kind == :info && "border-l-emerald-500 bg-white dark:bg-zinc-700 text-emerald-700 dark:text-emerald-300", + @kind == :warning && + "border-l-yellow-500 bg-white dark:bg-zinc-700 text-yellow-900 dark:text-yellow-300", @kind == :error && "border-l-red-500 bg-white dark:bg-zinc-700 text-red-900 dark:text-red-300" ]} @@ -66,6 +68,7 @@ defmodule MusicLibraryWeb.CoreComponents do >

<.icon :if={@kind == :info} name="hero-information-circle-mini" class="h-4 w-4" /> + <.icon :if={@kind == :warning} name="hero-exclamation-circle-mini" class="h-4 w-4" /> <.icon :if={@kind == :error} name="hero-exclamation-circle-mini" class="h-4 w-4" /> {@title}

@@ -94,6 +97,7 @@ defmodule MusicLibraryWeb.CoreComponents do ~H"""
<.flash kind={:info} title={gettext("Success!")} flash={@flash} /> + <.flash kind={:warning} title={gettext("Warning!")} flash={@flash} /> <.flash kind={:error} title={gettext("Error!")} flash={@flash} /> <.flash id="server-error" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 87db4a99..daaba711 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -813,3 +813,8 @@ msgstr "" #, elixir-autogen, elixir-format msgid "Scrobble disc" msgstr "" + +#: lib/music_library_web/components/core_components.ex +#, elixir-autogen, elixir-format +msgid "Warning!" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 45ca6cdf..5bd332cd 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -813,3 +813,8 @@ msgstr "" #, elixir-autogen, elixir-format, fuzzy msgid "Scrobble disc" msgstr "" + +#: lib/music_library_web/components/core_components.ex +#, elixir-autogen, elixir-format +msgid "Warning!" +msgstr ""