diff --git a/lib/yearbook_web/components/app_link.ex b/lib/yearbook_web/components/app_link.ex new file mode 100644 index 0000000..19cdc76 --- /dev/null +++ b/lib/yearbook_web/components/app_link.ex @@ -0,0 +1,53 @@ +defmodule YearbookWeb.Components.AppLink do + @moduledoc """ + A generalized link component with distinct visual variants. + """ + + use YearbookWeb, :html + + attr :href, :string, required: true + attr :variant, :atom, default: :default, values: [:default, :secondary] + attr :target, :string, default: nil + attr :class, :string, default: nil + attr :rest, :global + + slot :inner_block, required: true + + def action_link(%{variant: :default} = assigns) do + ~H""" + + {render_slot(@inner_block)} + + + """ + end + + def action_link(%{variant: :secondary} = assigns) do + ~H""" + + {render_slot(@inner_block)} + + + """ + end +end