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.
The default icon is face-frown from heroicons.
## Examples
<.icon name="hero-x-mark-solid" />
<.icon name="hero-arrow-path" class="custom-class" />
"""
attr :name, :string, required: true
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(assigns) do
~H"""
"""
end
end