defmodule ClaperWeb.EventLive.PollComponent do use ClaperWeb, :live_component @impl true def render(assigns) do ~H"""

<%= gettext "Current poll" %>

<%= @poll.title %>

<%= if (length @poll.poll_opts) > 0 do %> <%= for {opt, idx} <- Enum.with_index(@poll.poll_opts) do %> <%= if ! is_nil(@current_poll_vote) do %> <% else %> <% end %> <% end %> <% end %>
<%= if ! is_nil(@current_poll_vote) do %> <% else %> <% end %>
""" end def toggle_poll(js \\ %JS{}) do js |> JS.toggle( out: "animate__animated animate__zoomOut", in: "animate__animated animate__zoomIn", to: "#collapsed-poll", time: 50 ) |> JS.toggle( out: "animate__animated animate__zoomOut", in: "animate__animated animate__zoomIn", to: "#extended-poll" ) end end