defmodule FreediveWeb.LiliformLive do
use FreediveWeb, :live_view
def render(assigns) do
~H"""
<.block class="px-2 py-4">
<.panel is-info>
<.panel_heading>
Home
<.panel_tabs is-hidden-mobile>
All
Compute
Storage
Network
System
<.panel_tabs is-hidden-tablet>
<.icon for="all" color="auto" />
<.icon for="compute" color="auto" />
<.icon for="storage" color="auto" />
<.icon for="network" color="auto" />
<.icon for="system" color="auto" />
<.panel_block>
<.control has-icons-left>
<.icon for="search" size="1.5rem" aria-hidden="true" is-left />
<.section>
<.box>
<.button phx-click="color" phx-value-enable="true">
Color
<.button phx-click="color" phx-value-enable="false">
Grayscale
"""
end
def mount(_params, _session, socket) do
socket = assign(socket, query: "all")
{:ok, socket}
end
def handle_event("color", %{"enable" => "true"}, socket) do
Freedive.Features.enable(:colorhash)
{:noreply, assign(socket, query: "color")}
end
def handle_event("color", %{"enable" => "false"}, socket) do
Freedive.Features.disable(:colorhash)
{:noreply, assign(socket, query: "grayscale")}
end
end