source: Klonkt/src/views/partials/post-tile.ejs@ 55bba23

main
Last change on this file since 55bba23 was 6bee3ec, checked in by Robin Genis <roboburr@…>, 3 months ago

Pinned badge: white SVG pin icon instead of the multicolour 📌 emoji

The emoji ignored the badge's color:#fff. Swap it for a monochrome line-icon that
inherits the white text colour. style.css?v=49.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 2.2 KB
Line 
1<%
2// Square Instagram-style tile for the .feed-grid view (v9 pattern).
3// - With cover → background-image, dark gradient overlay reveals title on hover/touch
4// - No cover → .grid-tile-gradient with the title centered (random hue per tile)
5const _tileHue = ((post.id || post.slug || '0').charCodeAt(0) * 7) % 360;
6const _isPinned = !!post.pinned;
7const _hasCover = !!post.cover_image_url;
8const _typeLabel = (post.type && post.type !== 'post') ? post.type : '';
9const _src = post.source_name || ''; // bron-site (cirkel-feed: van welke site komt deze post)
10const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
11const _external = post.external_url || null;
12const _href = _external || (_base + '/' + post.slug);
13const _ext = !!_external;
14%>
15<a class="grid-tile<%= _hasCover ? '' : ' grid-tile-gradient' %><%= _isPinned ? ' is-pinned' : '' %>"
16 href="<%= _href %>"
17 <% if (_hasCover) { %>style="background-image: url('<%= post.cover_image_url %>'); --tile-hue: <%= _tileHue %>;"<% } else { %>style="--tile-hue: <%= _tileHue %>;"<% } %>
18 <% if (_ext) { %>target="_blank" rel="noopener"<% } else { %>hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="<%= _href %>" hx-indicator="#pcms-loading"<% } %>>
19
20 <% if (_typeLabel) { %>
21 <span class="grid-tile-type"><%= _typeLabel %></span>
22 <% } %>
23 <% if (_isPinned) { %>
24 <span class="grid-tile-pin"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg>Pinned</span>
25 <% } %>
26
27 <% if (_hasCover) { %>
28 <div class="grid-tile-overlay">
29 <strong><%= post.title || '(untitled)' %></strong>
30 <% if (_src) { %><span class="grid-tile-overlay-src">van <%= _src %></span><% } %>
31 </div>
32 <% } else { %>
33 <span class="grid-tile-title"><%= post.title || '(untitled)' %></span>
34 <% if (_src) { %><span class="grid-tile-gradient-src">van <%= _src %></span><% } %>
35 <% } %>
36</a>
Note: See TracBrowser for help on using the repository browser.