Skip to content

Commit

Permalink
fix: Add color attribute to wc_mdi.
Browse files Browse the repository at this point in the history
  • Loading branch information
GSMLG-BOT committed Dec 3, 2022
1 parent f420801 commit 00ad870
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 9 additions & 1 deletion apps/phoenix_webcomponent/lib/phoenix_webcomponent/icons.ex
Expand Up @@ -68,11 +68,19 @@ defmodule Phoenix.WebComponent.Icons do
"""
)

attr(:color, :string,
default: "currentcolor",
doc: """
icon color
"""
)

def wc_mdi(assigns) do
assigns =
assigns
|> assign_new(:id, fn -> false end)
|> assign_new(:class, fn -> false end)
|> assign_new(:color, fn -> "currentcolor" end)

name = assigns.name

Expand All @@ -84,7 +92,7 @@ defmodule Phoenix.WebComponent.Icons do
assigns = assigns |> assign(:inner_svg, inner_svg)

~H"""
<svg xmlns="http://www.w3.org/2000/svg" id={@id} class={@class} viewBox="0 0 24 24">
<svg xmlns="http://www.w3.org/2000/svg" id={@id} class={@class} fill={@color} viewBox="0 0 24 24">
<%= raw(@inner_svg) %>
</svg>
"""
Expand Down
Expand Up @@ -22,8 +22,9 @@
<logo-gsmlg-dev />
</:logo>
<:user_profile>
(^_^)
<.wc_mdi name="github" class="w-12 h-12" />
<.wc_link href={"https://github.com/gsmlg-dev/phoenix_webcomponent"}>
<.wc_mdi name="github" class="w-12 h-12" />
</.wc_link>
</:user_profile>
</.wc_simple_appbar>
<% else %>
Expand Down

0 comments on commit 00ad870

Please sign in to comment.