forked from hiway/freedive
Add stub for liliform liveview helper
This commit is contained in:
parent
2d33f14fcd
commit
0db3e9be30
2 changed files with 17 additions and 76 deletions
|
@ -1,79 +1,7 @@
|
|||
defmodule FreediveWeb.LiliformLive do
|
||||
defmacro __using__(_) do
|
||||
quote do
|
||||
use FreediveWeb, :live_view
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<.block class="px-2 py-4">
|
||||
<.panel is-info>
|
||||
<.panel_heading>
|
||||
Home
|
||||
</.panel_heading>
|
||||
|
||||
<.panel_tabs is-hidden-mobile>
|
||||
<a class="is-active">All</a>
|
||||
<a>Compute</a>
|
||||
<a>Storage</a>
|
||||
<a>Network</a>
|
||||
<a>System</a>
|
||||
</.panel_tabs>
|
||||
|
||||
<.panel_tabs is-hidden-tablet>
|
||||
<a title="All" is-active>
|
||||
<.icon for="all" color="auto" />
|
||||
</a>
|
||||
<a title="Compute">
|
||||
<.icon for="compute" color="auto" />
|
||||
</a>
|
||||
<a title="Storage">
|
||||
<.icon for="storage" color="auto" />
|
||||
</a>
|
||||
<a title="Network">
|
||||
<.icon for="network" color="auto" />
|
||||
</a>
|
||||
<a title="System">
|
||||
<.icon for="system" color="auto" />
|
||||
</a>
|
||||
</.panel_tabs>
|
||||
|
||||
<.panel_block>
|
||||
<.control has-icons-left>
|
||||
<input
|
||||
class="input is-info"
|
||||
type="text"
|
||||
placeholder="Search"
|
||||
name="search"
|
||||
value={@query}
|
||||
/>
|
||||
<.icon for="search" size="1.5rem" aria-hidden="true" is-left />
|
||||
</.control>
|
||||
</.panel_block>
|
||||
</.panel>
|
||||
</.block>
|
||||
<.section>
|
||||
<.box>
|
||||
<.button phx-click="color" phx-value-enable="true">
|
||||
Color
|
||||
</.button>
|
||||
<.button phx-click="color" phx-value-enable="false">
|
||||
Grayscale
|
||||
</.button>
|
||||
</.box>
|
||||
</.section>
|
||||
"""
|
||||
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
|
||||
end
|
||||
|
|
13
lib/freedive_web/live/service_live.ex
Normal file
13
lib/freedive_web/live/service_live.ex
Normal file
|
@ -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
|
Loading…
Reference in a new issue