use component macros for live_helper components

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