From f4c66f5a7cd6ba009ffb35ee212552625c9692ec Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sat, 8 Jun 2024 16:27:40 +0200 Subject: [PATCH] Nicer filtering/sorting look & feel on the explore page --- assets/css/_recording_list.scss | 23 ++++++- .../recording_html/index.html.heex | 64 ++++++++++--------- 2 files changed, 55 insertions(+), 32 deletions(-) diff --git a/assets/css/_recording_list.scss b/assets/css/_recording_list.scss index c1cd4ebe5..cda597d25 100644 --- a/assets/css/_recording_list.scss +++ b/assets/css/_recording_list.scss @@ -11,9 +11,24 @@ } } - .sorting { - margin-top: 2rem; + .heading { + display: flex; + gap: 1rem; + flex-wrap: wrap; + margin: 2rem 0 1rem 0; + h2 { + flex-grow: 1; + margin-top: 0; + } + } + + .toggles { + display: flex; + gap: 1rem; + } + + .filtering, .sorting { span { margin-right: 0.5rem; font-size: 0.875rem; @@ -22,6 +37,10 @@ a { border-color: #d3d9df; } + + .btn-group .active { + font-weight: 600; + } } .pagination { diff --git a/lib/asciinema_web/controllers/recording_html/index.html.heex b/lib/asciinema_web/controllers/recording_html/index.html.heex index bcd28ee4d..e982ec91b 100644 --- a/lib/asciinema_web/controllers/recording_html/index.html.heex +++ b/lib/asciinema_web/controllers/recording_html/index.html.heex @@ -1,34 +1,38 @@
-
-

Explore

+
+
+

Published recordings

- -
- -
-
-
-

<%= @page_title %>

-
+
+
+
+ <.active_link + href={~p"/explore/featured"} + title="featured" + active?={@category == :featured} + class="btn btn-light" + /> + <.active_link + href={~p"/explore/public"} + title="all public" + active?={@category == :public} + class="btn btn-light sort-popularity" + /> +
+
-
- Sort by -
<.active_link href="?order=date" - title="date" + title="by upload date" active?={@order == :date} class="btn btn-light" /> <.active_link href="?order=popularity" - title="popularity" + title="by popularity" active?={@order == :popularity} class="btn btn-light sort-popularity" /> @@ -36,22 +40,22 @@
+
+
-
-
-
-
- <.card asciicast={asciicast} /> -
-
+
+
+
+
+ <.card asciicast={asciicast} />
+
+
-
1} class="row"> -
- <%= pagination_links(@page, order: @order) %> -
-
+
1} class="row"> +
+ <%= pagination_links(@page, order: @order) %>