diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex index 52295d0..ee4c4da 100644 --- a/lib/pinchflat_web/components/core_components.ex +++ b/lib/pinchflat_web/components/core_components.ex @@ -14,7 +14,7 @@ defmodule PinchflatWeb.CoreComponents do Icons are provided by [heroicons](https://heroicons.com). See `icon/1` for usage. """ - use Phoenix.Component + use Phoenix.Component, global_prefixes: ~w(x-) import PinchflatWeb.Gettext @@ -654,10 +654,11 @@ defmodule PinchflatWeb.CoreComponents do """ attr :name, :string, required: true attr :class, :string, default: nil + attr :rest, :global def icon(%{name: "hero-" <> _} = assigns) do ~H""" - + """ end diff --git a/lib/pinchflat_web/components/custom_components/button_components.ex b/lib/pinchflat_web/components/custom_components/button_components.ex index c6f6e01..5e9ebe7 100644 --- a/lib/pinchflat_web/components/custom_components/button_components.ex +++ b/lib/pinchflat_web/components/custom_components/button_components.ex @@ -1,6 +1,8 @@ defmodule PinchflatWeb.CustomComponents.ButtonComponents do @moduledoc false - use Phoenix.Component + use Phoenix.Component, global_prefixes: ~w(x-) + + alias PinchflatWeb.CoreComponents @doc """ Render a button @@ -39,4 +41,52 @@ defmodule PinchflatWeb.CustomComponents.ButtonComponents do """ end + + @doc """ + Render a dropdown based off a button + + ## Examples + + <.button_dropdown text="Actions"> + <:option>TEST + + """ + attr :text, :string, required: true + attr :class, :string, default: "" + + slot :option, required: true + + def button_dropdown(assigns) do + ~H""" +