From d18f645c18cc56f8e5a39ff42b3f6a3239ab414a Mon Sep 17 00:00:00 2001 From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> Date: Tue, 21 May 2024 17:28:30 +0100 Subject: [PATCH] Add detailed-list style for RSS --- internal/assets/static/main.css | 64 +++++++++++++++++-- internal/assets/templates.go | 1 + internal/assets/templates/forum-posts.html | 2 +- .../assets/templates/rss-detailed-list.html | 38 +++++++++++ .../templates/rss-horizontal-cards-2.html | 2 +- .../templates/rss-horizontal-cards.html | 2 +- .../assets/templates/twitch-channels.html | 2 +- .../assets/templates/twitch-games-list.html | 2 +- internal/assets/templates/videos-grid.html | 2 +- internal/assets/templates/videos.html | 2 +- internal/feed/rss.go | 59 ++++++++++++++++- internal/feed/utils.go | 10 +++ internal/widget/rss.go | 11 ++++ 13 files changed, 182 insertions(+), 15 deletions(-) create mode 100644 internal/assets/templates/rss-detailed-list.html diff --git a/internal/assets/static/main.css b/internal/assets/static/main.css index 982d337..0806a8c 100644 --- a/internal/assets/static/main.css +++ b/internal/assets/static/main.css @@ -37,6 +37,7 @@ --ths: var(--bgh), calc(var(--bgs) * var(--tsm)); --color-text-base: hsl(var(--ths), calc(var(--scheme) var(--cm) * 58%)); + --color-text-base-muted: hsl(var(--ths), calc(var(--scheme) var(--cm) * 52%)); --color-text-highlight: hsl(var(--ths), calc(var(--scheme) var(--cm) * 85%)); --color-text-subdue: hsl(var(--ths), calc(var(--scheme) var(--cm) * 35%)); @@ -79,14 +80,16 @@ white-space: nowrap; } -.text-truncate-3-lines { +.text-truncate-2-lines, .text-truncate-3-lines { overflow: hidden; text-overflow: ellipsis; - -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; } +.text-truncate-3-lines { -webkit-line-clamp: 3; } +.text-truncate-2-lines { -webkit-line-clamp: 2; } + .visited-indicator:not(.text-truncate)::after, .visited-indicator.text-truncate::before, .bookmarks-link:not(.bookmarks-link-no-arrow)::after { @@ -114,6 +117,7 @@ .list-gap-14 { --list-half-gap: 0.7rem; } .list-gap-20 { --list-half-gap: 1rem; } .list-gap-24 { --list-half-gap: 1.2rem; } +.list-gap-34 { --list-half-gap: 1.7rem; } .list > *:not(:first-child) { margin-top: calc(var(--list-half-gap) * 2); @@ -190,6 +194,20 @@ background-color: var(--color-background); } +.attachments { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + margin-left: -0.5rem; +} + +.attachments > * { + border-radius: var(--border-radius); + padding: 0.1rem 0.5rem; + font-size: var(--font-size-h6); + background-color: var(--color-separator); +} + ::selection { background-color: hsl(var(--bghs), calc(var(--scheme) (var(--scheme) var(--bgl) + 20%))); color: var(--color-text-highlight); @@ -883,7 +901,18 @@ body { transition: filter 0.2s, opacity .2s; } -.thumbnail-container:hover .thumbnail { +.thumbnail-container { + flex-shrink: 0; + border: 1px solid var(--color-separator); + border-radius: var(--border-radius); +} + +.thumbnail-container > * { + border-radius: var(--border-radius); + object-fit: cover; +} + +.thumbnail-parent:hover .thumbnail { opacity: 1; filter: none; } @@ -931,6 +960,20 @@ body { z-index: 3; } +.rss-detailed-description { + max-width: 55rem; + color: var(--color-text-base-muted); +} + +.rss-detailed-thumbnail { + margin-top: 0.3rem; +} + +.rss-detailed-thumbnail > * { + aspect-ratio: 3 / 2; + height: 8.7rem; +} + .twitch-category-thumbnail { width: 5rem; border-radius: var(--border-radius); @@ -1171,11 +1214,11 @@ body { .dynamic-columns:has(> :nth-child(1)) { --columns-per-row: 1; } - .forum-post-list-item { - flex-flow: row-reverse; + .row-reverse-on-mobile { + flex-direction: row-reverse; } - .hide-on-mobile { + .hide-on-mobile, .thumbnail-container:has(> .hide-on-mobile) { display: none } @@ -1187,6 +1230,14 @@ body { color: var(--color-text-highlight); animation: pageColumnsEntrance .3s cubic-bezier(0.25, 1, 0.5, 1) backwards; } + + .rss-detailed-thumbnail > * { + height: 6rem; + } + + .rss-detailed-description { + -webkit-line-clamp: 3; + } } .size-h1 { font-size: var(--font-size-h1); } @@ -1250,3 +1301,4 @@ body { .margin-bottom-10 { margin-bottom: 1rem; } .margin-bottom-15 { margin-bottom: 1.5rem; } .margin-bottom-auto { margin-bottom: auto; } +.scale-half { transform: scale(0.5); } diff --git a/internal/assets/templates.go b/internal/assets/templates.go index 8dff7c0..548a4f0 100644 --- a/internal/assets/templates.go +++ b/internal/assets/templates.go @@ -27,6 +27,7 @@ var ( VideosGridTemplate = compileTemplate("videos-grid.html", "widget-base.html", "video-card-contents.html") StocksTemplate = compileTemplate("stocks.html", "widget-base.html") RSSListTemplate = compileTemplate("rss-list.html", "widget-base.html") + RSSDetailedListTemplate = compileTemplate("rss-detailed-list.html", "widget-base.html") RSSHorizontalCardsTemplate = compileTemplate("rss-horizontal-cards.html", "widget-base.html") RSSHorizontalCards2Template = compileTemplate("rss-horizontal-cards-2.html", "widget-base.html") MonitorTemplate = compileTemplate("monitor.html", "widget-base.html") diff --git a/internal/assets/templates/forum-posts.html b/internal/assets/templates/forum-posts.html index afaf07f..529cc25 100644 --- a/internal/assets/templates/forum-posts.html +++ b/internal/assets/templates/forum-posts.html @@ -4,7 +4,7 @@
{{ .Description }}
+ {{ end }} + {{ if gt (len .Categories) 0 }} + + {{ end }} +