use component macros for live_helper components
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
shibao 2023-03-15 00:48:07 -04:00
parent 8163b906a2
commit ab8561fcf0

View File

@ -3,9 +3,12 @@ defmodule CanneryWeb.LiveHelpers do
Contains common helper functions for liveviews Contains common helper functions for liveviews
""" """
import Phoenix.Component use Phoenix.Component
alias Phoenix.LiveView.JS alias Phoenix.LiveView.JS
attr :return_to, :string, required: true
slot(:inner_block)
@doc """ @doc """
Renders a live component inside a modal. Renders a live component inside a modal.
@ -79,6 +82,11 @@ defmodule CanneryWeb.LiveHelpers do
|> JS.hide(to: "#modal-content", transition: "fade-out-scale") |> JS.hide(to: "#modal-content", transition: "fade-out-scale")
end end
attr :action, :string, required: true
attr :value, :boolean, required: true
attr :id, :string
slot(:inner_block)
@doc """ @doc """
A toggle button element that can be directed to a liveview or a A toggle button element that can be directed to a liveview or a
live_component's `handle_event/3`. live_component's `handle_event/3`.