defmodule Noora.ProgressBar do @moduledoc """ Progress bar component ## Example ```elixir <.progress_bar value={75} max={100} title="Upload Progress" /> ``` """ use Phoenix.Component import Noora.Utils attr(:value, :integer, required: true, doc: "The current value.") attr(:max, :integer, required: true, doc: "Maximum value.") attr(:title, :string, default: nil, doc: "The title of the progress bar") attr(:rest, :global) slot(:description) def progress_bar(assigns) do ~H"""
{@title} {@value} {@max}
<%= if has_slot_content?(@description, assigns) do %> {render_slot(@description)} <% end %>
""" end end