From b5a7414e7ccf6f25c385b9d18b7a2fed45486b4d Mon Sep 17 00:00:00 2001 From: Mathias Polligkeit Date: Wed, 25 Oct 2023 22:31:06 +0900 Subject: [PATCH] refactor: clean up icon component --- lib/doggo.ex | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/lib/doggo.ex b/lib/doggo.ex index 512da191..15f4295f 100644 --- a/lib/doggo.ex +++ b/lib/doggo.ex @@ -126,29 +126,15 @@ defmodule Doggo do attr :rest, :global, doc: "Any additional HTML attributes." def icon(assigns) do - unless assigns.icon_position in [:left, :right] do - raise """ - Invalid icon position - - Allowed values: :left, :right - - Got: #{inspect(assigns.icon_position)} - """ - end - ~H""" - <%= if @text && @icon_position == :right do %> - <%= @text %> - <% end %> + <%= @text %> - <%= if @text && @icon_position == :left do %> - <%= @text %> - <% end %> + <%= @text %> """ end @@ -156,17 +142,7 @@ defmodule Doggo do defp icon_size_class(:medium), do: "is-medium" defp icon_size_class(:small), do: "is-small" defp icon_size_class(:large), do: "is-large" - defp icon_size_class(:normal), do: nil - - defp icon_size_class(size) do - raise """ - Invalid icon size - - Allowed sizes: :small, :normal, :medium, :large - - Got: #{inspect(size)} - """ - end + defp icon_size_class(:normal), do: "is-normal" @doc """ Renders a list of properties, i.e. key/value pairs.