defmodule SwornforgedWeb.CoreComponents do @moduledoc """ Provides core UI components. The components in this module use Tailwind CSS, a utility-first CSS framework. See the [Tailwind CSS documentation](https://tailwindcss.com) to learn how to customize the generated components in this module. Icons are provided by [heroicons](https://heroicons.com), using the [heroicons_elixir](https://github.com/mveytsman/heroicons_elixir) project. """ use Phoenix.Component alias Phoenix.LiveView.JS import SwornforgedWeb.Gettext @doc """ Renders a modal. ## Examples <.modal id="confirm-modal"> Are you sure? <:confirm>OK <:cancel>Cancel JS commands may be passed to the `:on_cancel` and `on_confirm` attributes for the caller to react to each button press, for example: <.modal id="confirm" on_confirm={JS.push("delete")} on_cancel={JS.navigate(~p"/posts")}> Are you sure you? <:confirm>OK <:cancel>Cancel """ attr :id, :string, required: true attr :show, :boolean, default: false attr :on_cancel, JS, default: %JS{} attr :on_confirm, JS, default: %JS{} slot :inner_block, required: true slot :title slot :subtitle slot :confirm slot :cancel def modal(assigns) do ~H"""