diff --git a/lib/comfycamp_web/components/flash.ex b/lib/comfycamp_web/components/flash.ex index 005778e..6c31049 100644 --- a/lib/comfycamp_web/components/flash.ex +++ b/lib/comfycamp_web/components/flash.ex @@ -41,13 +41,13 @@ defmodule ComfycampWeb.Flash do {@rest} >
- <.icon :if={@kind == :error} name="hero-exclamation-circle" /> - <.icon :if={@kind == :info} name="hero-information-circle" /> + <.exclamation_circle_icon :if={@kind == :error} /> + <.information_circle_icon :if={@kind == :info} /> <%= @title %>
<%= msg %>
""" diff --git a/lib/comfycamp_web/components/icons.ex b/lib/comfycamp_web/components/icons.ex index a64cc7c..53d9437 100644 --- a/lib/comfycamp_web/components/icons.ex +++ b/lib/comfycamp_web/components/icons.ex @@ -1,191 +1,17 @@ defmodule ComfycampWeb.Icons do @moduledoc """ Provides reusable svg icons. - - I would like to store icons as .svg files, - but I don’t want to write a custom loader. - - When trying to use the img element, we lose the ability to inherit color. - - For now, I find this approach tolerable. """ use Phoenix.Component - @doc """ - Icon component. + embed_templates "icons/*" - The default icon is face-frown from heroicons. - - ## Examples - - <.icon name="hero-x-mark" /> - <.icon name="si-mastodon" class="custom-class" /> - """ - attr :name, :string, required: true + attr :name, :string, default: nil attr :class, :string, default: nil - def icon(%{name: "hero-exclamation-circle"} = assigns) do - ~H""" - - """ - end - - def icon(%{name: "hero-information-circle"} = assigns) do - ~H""" - - """ - end - - def icon(%{name: "hero-x-mark"} = assigns) do - ~H""" - - """ - end - - def icon(%{name: "hero-code-bracket"} = assigns) do - ~H""" - - """ - end - - def icon(%{name: "hero-envelope"} = assigns) do - ~H""" - - """ - end - - def icon(%{name: "si-mastodon"} = assigns) do - ~H""" - - """ - end - - def icon(%{name: "si-xmpp"} = assigns) do - ~H""" - - """ - end - - def icon(%{name: "si-matrix"} = assigns) do - ~H""" - - """ - end - - def icon(%{name: "yggdrasil"} = assigns) do - ~H""" - - """ - end - def icon(assigns) do ~H""" - + Missing icon """ end end diff --git a/lib/comfycamp_web/components/icons/code_bracket_icon.svg.heex b/lib/comfycamp_web/components/icons/code_bracket_icon.svg.heex new file mode 100644 index 0000000..3def155 --- /dev/null +++ b/lib/comfycamp_web/components/icons/code_bracket_icon.svg.heex @@ -0,0 +1,14 @@ + diff --git a/lib/comfycamp_web/components/icons/envelope_icon.svg.heex b/lib/comfycamp_web/components/icons/envelope_icon.svg.heex new file mode 100644 index 0000000..4f83d5b --- /dev/null +++ b/lib/comfycamp_web/components/icons/envelope_icon.svg.heex @@ -0,0 +1,14 @@ + diff --git a/lib/comfycamp_web/components/icons/exclamation_circle_icon.svg.heex b/lib/comfycamp_web/components/icons/exclamation_circle_icon.svg.heex new file mode 100644 index 0000000..0bf37c9 --- /dev/null +++ b/lib/comfycamp_web/components/icons/exclamation_circle_icon.svg.heex @@ -0,0 +1,14 @@ + diff --git a/lib/comfycamp_web/components/icons/information_circle_icon.svg.heex b/lib/comfycamp_web/components/icons/information_circle_icon.svg.heex new file mode 100644 index 0000000..ccd39be --- /dev/null +++ b/lib/comfycamp_web/components/icons/information_circle_icon.svg.heex @@ -0,0 +1,14 @@ + diff --git a/lib/comfycamp_web/components/icons/mastodon_icon.svg.heex b/lib/comfycamp_web/components/icons/mastodon_icon.svg.heex new file mode 100644 index 0000000..f2c77ab --- /dev/null +++ b/lib/comfycamp_web/components/icons/mastodon_icon.svg.heex @@ -0,0 +1,9 @@ + diff --git a/lib/comfycamp_web/components/icons/matrix_icon.svg.heex b/lib/comfycamp_web/components/icons/matrix_icon.svg.heex new file mode 100644 index 0000000..da02ab7 --- /dev/null +++ b/lib/comfycamp_web/components/icons/matrix_icon.svg.heex @@ -0,0 +1,9 @@ + diff --git a/lib/comfycamp_web/components/icons/x_mark_icon.svg.heex b/lib/comfycamp_web/components/icons/x_mark_icon.svg.heex new file mode 100644 index 0000000..c222cd6 --- /dev/null +++ b/lib/comfycamp_web/components/icons/x_mark_icon.svg.heex @@ -0,0 +1,10 @@ + diff --git a/lib/comfycamp_web/components/icons/xmpp_icon.svg.heex b/lib/comfycamp_web/components/icons/xmpp_icon.svg.heex new file mode 100644 index 0000000..9b26d0e --- /dev/null +++ b/lib/comfycamp_web/components/icons/xmpp_icon.svg.heex @@ -0,0 +1,9 @@ + diff --git a/lib/comfycamp_web/components/icons/yggdrasil_icon.svg.heex b/lib/comfycamp_web/components/icons/yggdrasil_icon.svg.heex new file mode 100644 index 0000000..fd727d9 --- /dev/null +++ b/lib/comfycamp_web/components/icons/yggdrasil_icon.svg.heex @@ -0,0 +1,3 @@ + diff --git a/lib/comfycamp_web/components/layouts/app.html.heex b/lib/comfycamp_web/components/layouts/app.html.heex index a7040b8..9189b3a 100644 --- a/lib/comfycamp_web/components/layouts/app.html.heex +++ b/lib/comfycamp_web/components/layouts/app.html.heex @@ -12,28 +12,28 @@