defmodule PokemonCoutureWeb.Components.ClothesComponent do
use Phoenix.LiveComponent
def mount(socket) do
socket =
socket
|> assign(active: true)
{:ok, socket}
end
def render(assigns) do
~L"""
<%= @clothes.name %>
<%= @clothes.color %>
<%= @clothes.game %>
"""
end
def handle_event("toggle-active", _value, socket) do
socket =
socket
|> assign(:active, not socket.assigns.active)
{:noreply, socket}
end
end