defmodule Moon.Design.Button do
@moduledoc false
use Moon.StatelessComponent
use Moon.Design.Button.Properties
alias Moon.Components.AsComponent
alias Moon.Design.Button.Utils
alias Moon.Icon
alias Moon.Design.Loader
def render(assigns) do
~F"""
{#if @animation}
{animation_content(assigns)}
{content(assigns)}
{#else}
{content(assigns)}
{/if}
"""
end
defp animation_content(assigns) do
~F"""
{#if @animation == "progress"}
{#elseif @animation == "success"}
{/if}
"""
end
defp content(assigns) do
~F"""
{#if slot_assigned?(:left_icon_slot)}
<#slot {@left_icon_slot} />
{#else}
{/if}
<#slot />
{#if slot_assigned?(:right_icon_slot)}
<#slot {@right_icon_slot} />
{#else}
{/if}
"""
end
end