defmodule Phoenix.UI.Components.Progress do @moduledoc """ Provides progress-related components. """ use Phoenix.UI, :component attr(:color, :string, default: "blue", doc: "The color of the component.", values: Theme.colors() ) attr(:extend_class, :string, default: nil, doc: "Extend existing classes applied to the component." ) attr(:rest, :global, doc: "Arbitrary HTML or phx attributes") attr(:size, :any, doc: "The size of the component.") attr(:square, :boolean, default: false, doc: "If true, rounded corners are disabled.") attr(:text, :string, default: nil, doc: "Draws a graphics element consisting of text") attr(:value, :integer, default: 30, doc: "The value of the progress indicator for the determinate variant. Value between 0 and 100." ) attr(:variant, :string, default: "radial", doc: "The variant to use.", values: ["linear", "radial"] ) @doc """ A progress component displays the status of a given process. ## Examples <.progress variant="radial" /> """ @spec progress(Socket.assigns()) :: Rendered.t() def progress(%{variant: "radial"} = assigns) do assigns = assign_new(assigns, :size, fn -> 12 end) ~H""" """ end def progress(assigns) do assigns = assign_new(assigns, :size, fn -> 5 end) ~H"""
<%= @text %>
""" end end