diff --git a/lib/music_library_web/components/record_components.ex b/lib/music_library_web/components/record_components.ex index e89a6281..462cc9ec 100644 --- a/lib/music_library_web/components/record_components.ex +++ b/lib/music_library_web/components/record_components.ex @@ -190,16 +190,21 @@ defmodule MusicLibraryWeb.RecordComponents do end attr :records, :list, required: true - attr :records_count, :integer, required: true - attr :title, :string, required: true + attr :records_count, :integer, default: 0 + attr :title, :string, default: nil attr :id, :string, required: true attr :record_show_path, :any, required: true attr :record_edit_path, :any, required: true + attr :display_artist_names, :boolean, default: false + attr :density, :atom, values: [:low, :high], default: :low def record_grid(assigns) do ~H"""
-
+

{@title}

@@ -212,7 +217,12 @@ defmodule MusicLibraryWeb.RecordComponents do id={@id} phx-update="stream" role="list" - class="mt-4 grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-4 sm:gap-x-6 xl:gap-x-8" + class={[ + @density == :low && + "mt-4 grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-4 sm:gap-x-6 xl:gap-x-8", + @density == :high && + "mt-4 grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-4 md:grid-cols-6 xl:grid-cols-8" + ]} >
  • @@ -282,108 +292,16 @@ defmodule MusicLibraryWeb.RecordComponents do
  • -
    -

    - {record.title} -

    -
    -

    - {format_label(record.format)} · {type_label(record.type)} -

    -

    - {Records.Record.format_release_date(record.release_date)} -

    - - - - """ - end - - attr :records, :list, required: true - attr :id, :string, required: true - attr :record_show_path, :any, required: true - attr :record_edit_path, :any, required: true - - def dense_record_grid(assigns) do - ~H""" -
    -
    - <.dense_record_grid + <.record_grid :if={@display == :grid} id="collection" records={@streams.records} record_show_path={fn record -> ~p"/collection/#{record}" end} record_edit_path={fn record -> ~p"/collection/#{record}/edit" end} + display_artist_names + density={:high} /> <.record_list diff --git a/lib/music_library_web/live/wishlist_live/index.html.heex b/lib/music_library_web/live/wishlist_live/index.html.heex index 8890eff7..bf3239e8 100644 --- a/lib/music_library_web/live/wishlist_live/index.html.heex +++ b/lib/music_library_web/live/wishlist_live/index.html.heex @@ -76,12 +76,14 @@ - <.dense_record_grid + <.record_grid :if={@display == :grid} id="wishlist" records={@streams.records} record_show_path={fn record -> ~p"/wishlist/#{record}" end} record_edit_path={fn record -> ~p"/wishlist/#{record}/edit" end} + display_artist_names + density={:high} /> <.record_list diff --git a/test/music_library_web/live/collection_live/index_test.exs b/test/music_library_web/live/collection_live/index_test.exs index 7bff2781..f4381a8a 100644 --- a/test/music_library_web/live/collection_live/index_test.exs +++ b/test/music_library_web/live/collection_live/index_test.exs @@ -241,7 +241,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do |> assert_has("p", text: "Record updated successfully") updated_record = MusicLibrary.Records.get_record!(record.id) - updated_cover_url = cover_url(updated_record, 560) + updated_cover_url = cover_url(updated_record, 460) assert updated_record.cover_hash !== record.cover_hash assert_has(session, "img[src='#{updated_cover_url}']")