From 0db3e9be305094e384e9bfc412b5328f9bdedf31 Mon Sep 17 00:00:00 2001 From: Harshad Sharma Date: Thu, 16 May 2024 01:48:55 +0530 Subject: [PATCH] Add stub for liliform liveview helper --- lib/freedive_web/live/liliform_live.ex | 80 ++------------------------ lib/freedive_web/live/service_live.ex | 13 +++++ 2 files changed, 17 insertions(+), 76 deletions(-) create mode 100644 lib/freedive_web/live/service_live.ex diff --git a/lib/freedive_web/live/liliform_live.ex b/lib/freedive_web/live/liliform_live.ex index 87396ed..d9cb8b1 100644 --- a/lib/freedive_web/live/liliform_live.ex +++ b/lib/freedive_web/live/liliform_live.ex @@ -1,79 +1,7 @@ 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")} + defmacro __using__(_) do + quote do + use FreediveWeb, :live_view + end end end diff --git a/lib/freedive_web/live/service_live.ex b/lib/freedive_web/live/service_live.ex new file mode 100644 index 0000000..5651999 --- /dev/null +++ b/lib/freedive_web/live/service_live.ex @@ -0,0 +1,13 @@ +defmodule FreediveWeb.ServiceLive do + use FreediveWeb.LiliformLive + + def render(assigns) do + ~H""" + Hello, World! + """ + end + + def mount(_params, _session, socket) do + {:ok, socket} + end +end