Move search_form to CoreComponents
This commit is contained in:
@@ -19,6 +19,8 @@ defmodule MusicLibraryWeb.CoreComponents do
|
||||
|
||||
alias Phoenix.LiveView.JS
|
||||
|
||||
import Fluxon.Components.Input
|
||||
|
||||
@doc """
|
||||
Renders a simple form.
|
||||
|
||||
@@ -55,6 +57,25 @@ defmodule MusicLibraryWeb.CoreComponents do
|
||||
"""
|
||||
end
|
||||
|
||||
attr :query, :string, required: true
|
||||
|
||||
def search_form(assigns) do
|
||||
~H"""
|
||||
<form class="w-full sm:w-1/3" for={@query} phx-submit="search" phx-change="search">
|
||||
<.input
|
||||
type="search"
|
||||
size="sm"
|
||||
id={:query}
|
||||
name={:query}
|
||||
value={@query}
|
||||
placeholder={gettext("Search")}
|
||||
phx-debounce="500"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</form>
|
||||
"""
|
||||
end
|
||||
|
||||
@doc """
|
||||
Renders a [Heroicon](https://heroicons.com).
|
||||
|
||||
|
||||
@@ -188,25 +188,6 @@ defmodule MusicLibraryWeb.RecordComponents do
|
||||
"""
|
||||
end
|
||||
|
||||
attr :query, :string, required: true
|
||||
|
||||
def search_form(assigns) do
|
||||
~H"""
|
||||
<form class="w-full sm:w-1/3" for={@query} phx-submit="search" phx-change="search">
|
||||
<.input
|
||||
type="search"
|
||||
size="sm"
|
||||
id={:query}
|
||||
name={:query}
|
||||
value={@query}
|
||||
placeholder={gettext("Search")}
|
||||
phx-debounce="500"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</form>
|
||||
"""
|
||||
end
|
||||
|
||||
attr :records, :list, required: true
|
||||
attr :records_count, :integer, required: true
|
||||
attr :title, :string, required: true
|
||||
|
||||
@@ -2,7 +2,6 @@ defmodule MusicLibraryWeb.ScrobbledTracksLive.Index do
|
||||
use MusicLibraryWeb, :live_view
|
||||
|
||||
import MusicLibraryWeb.Components.Pagination
|
||||
import MusicLibraryWeb.RecordComponents, only: [search_form: 1]
|
||||
|
||||
alias LastFm.Track
|
||||
alias MusicLibrary.ScrobbleActivity
|
||||
|
||||
@@ -181,8 +181,7 @@ msgstr ""
|
||||
msgid "Saving..."
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex
|
||||
#: lib/music_library_web/live/scrobble_live/index.html.heex
|
||||
#: lib/music_library_web/components/core_components.ex
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
@@ -1408,11 +1407,6 @@ msgstr ""
|
||||
msgid "Scrobble"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/live/scrobble_live/index.html.heex
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Scrobble to Last.fm"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/live/scrobble_live/index.ex
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Failed to fetch releases for this release group"
|
||||
@@ -1422,8 +1416,3 @@ msgstr ""
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Failed to search for release groups"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/live/scrobble_live/index.html.heex
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Searching..."
|
||||
msgstr ""
|
||||
|
||||
@@ -181,8 +181,7 @@ msgstr ""
|
||||
msgid "Saving..."
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/components/record_components.ex
|
||||
#: lib/music_library_web/live/scrobble_live/index.html.heex
|
||||
#: lib/music_library_web/components/core_components.ex
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
@@ -1408,11 +1407,6 @@ msgstr ""
|
||||
msgid "Scrobble"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/live/scrobble_live/index.html.heex
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "Scrobble to Last.fm"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/live/scrobble_live/index.ex
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "Failed to fetch releases for this release group"
|
||||
@@ -1422,8 +1416,3 @@ msgstr ""
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "Failed to search for release groups"
|
||||
msgstr ""
|
||||
|
||||
#: lib/music_library_web/live/scrobble_live/index.html.heex
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "Searching..."
|
||||
msgstr ""
|
||||
|
||||
Reference in New Issue
Block a user