feat(chat): extract room forms to SlaxWeb.RoomComponents
This commit is contained in:
20
lib/slax_web/components/room_components.ex
Normal file
20
lib/slax_web/components/room_components.ex
Normal file
@@ -0,0 +1,20 @@
|
||||
defmodule SlaxWeb.RoomComponents do
|
||||
@moduledoc false
|
||||
use Phoenix.Component
|
||||
|
||||
import SlaxWeb.CoreComponents
|
||||
|
||||
attr :form, Phoenix.HTML.Form, required: true
|
||||
|
||||
def room_form(assigns) do
|
||||
~H"""
|
||||
<.simple_form for={@form} id="room-form" phx-change="validate-room" phx-submit="save-room">
|
||||
<.input field={@form[:name]} type="text" label="Name" phx-debounce />
|
||||
<.input field={@form[:topic]} type="text" label="Topic" phx-debounce />
|
||||
<:actions>
|
||||
<.button phx-disable-with="Saving..." class="w-full">Save</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
"""
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user