phoenix-test/lib/quip_web/controllers/demo_controller.ex

22 lines
503 B
Elixir

defmodule QuipWeb.DemoController do
use QuipWeb, :live_view
def handle_event("click", _, socket) do
{:noreply,
socket
|> push_event("demo-event", %{name: "World"})}
end
def render(assigns) do
~H"""
<button
type="button"
class="rounded-md bg-black px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2"
phx-click="click"
>
Click me
</button>
"""
end
end