defmodule MusicLibraryWeb.SearchComponents do @moduledoc """ Universal search modal and related components. """ use Phoenix.Component use Gettext, backend: MusicLibraryWeb.Gettext import MusicLibraryWeb.CoreComponents, only: [icon: 1] @doc """ Renders a search trigger button that opens the universal search modal. ## Examples <.search_trigger /> """ attr :class, :string, default: "" attr :rest, :global, include: ~w(phx-click phx-target) def search_trigger(assigns) do ~H""" """ end @doc """ Renders a search result item for records. ## Examples <.search_result_record record={record} selected={false} /> """ attr :record, :map, required: true attr :selected, :boolean, default: false attr :type, :atom, required: true, values: [:collection, :wishlist] attr :rest, :global, include: ~w(phx-click phx-value-id) def search_result_record(assigns) do ~H"""
{@record.title}
{@record.artists |> Enum.map(& &1.name) |> Enum.join(", ")}
{@artist.name}
{@artist.disambiguation}
Start typing to search your records and artists
Use Ctrl+K to open this search
No results found for "{@query}"
Try a different search term or check your spelling
Searching...