diff --git a/lib/freedive_web/live/liliform_live.ex b/lib/freedive_web/live/liliform_live.ex
index 1d80381..202a458 100644
--- a/lib/freedive_web/live/liliform_live.ex
+++ b/lib/freedive_web/live/liliform_live.ex
@@ -3,7 +3,7 @@ defmodule FreediveWeb.LiliformLive do
quote location: :keep, bind_quoted: [opts: opts] do
use FreediveWeb, :live_view
@behaviour FreediveWeb.LiliformLive
- @all [
+ @filters_all [
%{
title: "All",
icon: "all",
@@ -12,13 +12,21 @@ defmodule FreediveWeb.LiliformLive do
]
def(mount(_params, _session, socket)) do
+ items = items()
socket = assign(socket, :opts, Keyword.get(unquote(opts), :opts, []))
- socket = assign(socket, :items, items())
- socket = assign(socket, :filters, @all ++ filters())
+ socket = assign(socket, :items_all, items)
+ socket = assign(socket, :items, items)
+ socket = assign(socket, :filters, @filters_all ++ filters())
socket = assign(socket, :query, "")
+ IO.inspect(socket, label: "socket")
{:ok, socket}
end
+ def(handle_event("search", %{"value" => query}, socket)) do
+ items = search(query)
+ socket = assign(socket, :items, items)
+ {:noreply, socket}
+ end
end
end
diff --git a/lib/freedive_web/live/service_live.ex b/lib/freedive_web/live/service_live.ex
index 9dc7e95..4a2e7b6 100644
--- a/lib/freedive_web/live/service_live.ex
+++ b/lib/freedive_web/live/service_live.ex
@@ -4,8 +4,8 @@ defmodule FreediveWeb.ServiceLive do
def render(assigns) do
~H"""
<.block class="px-2 py-4">
- <.page name="Services">
-
+ <.page name="Services" filters={@filters}>
+
"""
@@ -82,7 +82,7 @@ defmodule FreediveWeb.ServiceLive.Item do
"""
attr :items, :list, default: [], doc: "items"
- def item_block(assigns) do
+ def items_block(assigns) do
~H"""
<%= for item <- @items do %>
<.link patch={item.path} class="panel-block pt-1">
diff --git a/lib/liliform/page.ex b/lib/liliform/page.ex
index 8c77378..aed8cfd 100644
--- a/lib/liliform/page.ex
+++ b/lib/liliform/page.ex
@@ -42,7 +42,7 @@ defmodule Liliform.Page do
<.panel_block>
<.control has-icons-left>
-
+
<.icon for="search" size="1.5rem" aria-hidden="true" is-left />