Walk-back two-column comments design

This commit is contained in:
Jason Zimdars
2025-03-24 17:43:43 -05:00
parent abeb0762f6
commit 403a328ef8
5 changed files with 12 additions and 51 deletions
+2 -26
View File
@@ -3,30 +3,10 @@
--comment-padding-block: 0.33lh;
--comment-padding-inline: 2ch;
display: flex;
font-size: 1.33cqi;
gap: var(--comment-padding-block);
inline-size: 100%;
max-inline-size: 60cqi;
@media (max-width: 70ch) {
max-inline-size: 100%;
}
}
.comments__column {
display: flex;
flex-direction: column;
flex: 4 1 80%;
gap: var(--comment-padding-block);
}
.events__column {
display: flex;
flex-direction: column;
flex: 1 0 20%;
gap: 1lh;
margin-block-start: 0.8em;
margin-inline: var(--tray-size);
}
.comment {
@@ -120,9 +100,5 @@
}
.event-summary {
color: var(--bubble-color);
font-size: 0.8em;
font-weight: 500;
gap: 0.5ch;
text-align: start;
padding-inline-start: 3rem;
}
+1 -1
View File
@@ -1,7 +1,7 @@
module MessagesHelper
def messages_tag(bubble, &)
turbo_frame_tag dom_id(bubble, :messages),
class: "comments center borderless gap-half",
class: "comments borderless gap-half",
style: "--bubble-color: <%= bubble.color %>",
role: "group", aria: { label: "Messages" },
data: {
+1 -18
View File
@@ -1,22 +1,5 @@
<%= messages_tag(bubble) do %>
<%# Template Dependency: comments/comment %>
<%# Template Dependency: event_summaries/event_summary %>
<%#= render bubble.messages, cached: true %>
<div class="comments__column">
<%= render bubble.messages.comments %>
<%= render "comments/new", bubble: bubble, cached: true %>
<div class="flex flex-column margin-block-start-double txt-align-start" style="margin-inline-start: calc(var(--avatar-size) + var(--inline-space));">
<strong class="txt-uppercase">Subscribers</strong>
<p class="margin-none-block-start margin-block-end-half"><%= pluralize(@bubble.watchers.count, "person") %> will be notified when someone comments on this.</p>
<div class="flex align-center flex-wrap gap-half max-width" style="font-size: 0.8em;">
<%= render partial: "bubbles/watches/watcher", collection: @bubble.watchers.sorted_with_user_first(Current.user) %>
</div>
</div>
</div>
<div class="events__column">
<%= render bubble.messages.event_summaries, bubble: bubble, cached: true %>
</div>
<%= render bubble.messages, cached: true %>
<% end %>
+4 -3
View File
@@ -63,7 +63,7 @@
<% if @bubble.published? %>
<%= render "bubbles/messages", bubble: @bubble %>
<% else %>
<div class="comments center pad-block flex align-center gap">
<div class="comments pad-block">
<div class="comment comment--new flex-inline align-start full-width">
<figure class="comment__avatar flex-item-no-shrink" aria-hidden="true">
<%= avatar_tag Current.user, hidden_for_screen_reader: true, loading: :lazy %>
@@ -94,6 +94,7 @@
<% end %>
</div>
<%= link_to "Go back", "#", class: "btn",
<%= link_to "Go back", "#", class: "btn", hidden: true,
data: { controller: "back-navigation hotkey",
action: "keydown.esc@document->hotkey#click", back_navigation_fallback_destination_value: bubbles_path(bucket_id: @bubble.bucket) } %>
action: "keydown.esc@document->hotkey#click",
back_navigation_fallback_destination_value: bubbles_path(bucket_id: @bubble.bucket) } %>
@@ -1,7 +1,8 @@
<% unless event_summary.body.blank? %>
<div class="event-summary flex flex-column justify-start txt-tight-lines">
<strong class="txt-uppercase"><%= local_datetime_tag event_summary.created_at, style: :shortdate %></strong>
<hr class="separator--horizontal margin-none full-width" style="--border-color: var(--color-subtle-dark);">
<div class="event-summary comment__content flex flex-column justify-start txt-tight-lines">
<div class="comment__author flex align-center gap-half">
<span class="comment__timestamp txt-uppercase"><%= local_datetime_tag event_summary.created_at, style: :shortdate %></span>
</div>
<div class="flex flex-wrap" data-controller="event-summary">
<%= event_summary.body %>
</div>