Skip to content

A platform for community discussion. Free, open, simple.

UX: improve quote title alignment, wrapping (#33796)

Kris5ddd04fa0b49
diff --git a/app/assets/stylesheets/common/base/topic-post.scss b/app/assets/stylesheets/common/base/topic-post.scss
index e128c31ff47..dce026105b3 100644
--- a/app/assets/stylesheets/common/base/topic-post.scss
+++ b/app/assets/stylesheets/common/base/topic-post.scss
@@ -629,6 +629,9 @@ aside.quote {
margin-bottom: 1em;
.title {
+ display: flex;
+ align-items: start;
+ gap: var(--space-2);
color: var(--primary-high-or-secondary-low);
padding: 0.8em 0.8em 0 0.8em;
@@ -639,13 +642,36 @@ aside.quote {
cursor: pointer;
}
- // blockquote is underneath this and has top margin
- .avatar {
- margin-right: 0.5em;
+ a {
+ @include ellipsis;
+ }
+
+ .badge-category__wrapper {
+ align-self: center;
+ }
+
+ .quote-controls {
+ min-height: 24px; // match avatar height for alignment
+ }
+
+ // empty control div can impact layout, so hide it
+ &:not([data-has-quote-controls]) {
+ .quote-controls {
+ display: none;
+ }
}
+ }
+
+ .quote-title__text-content {
+ flex: 1 1 auto;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: baseline;
+ gap: 0 var(--space-2);
+ min-width: 0;
- img {
- margin-top: -0.26em;
+ .badge-category__wrapper {
+ align-self: auto;
}
}
@@ -677,9 +703,9 @@ aside.quote {
}
.quote-controls {
- float: right;
display: flex;
align-items: center;
+ margin-left: auto;
a {
margin-left: 0.3em;
diff --git a/lib/onebox/templates/discourse_topic_onebox.mustache b/lib/onebox/templates/discourse_topic_onebox.mustache
index 856d3342d47..cf2f434356e 100644
--- a/lib/onebox/templates/discourse_topic_onebox.mustache
+++ b/lib/onebox/templates/discourse_topic_onebox.mustache
@@ -2,7 +2,9 @@
<div class='title'>
<div class='quote-controls'></div>
{{{avatar}}}
- <a href="{{original_url}}">{{{title}}}</a> {{{category_html}}}
+ <div class="quote-title__text-content">
+ <a href="{{original_url}}">{{{title}}}</a> {{{category_html}}}
+ </div>
</div>
<blockquote>
{{{quote}}}
diff --git a/spec/services/username_changer_spec.rb b/spec/services/username_changer_spec.rb
index 231972b40a1..338ddaf745f 100644
--- a/spec/services/username_changer_spec.rb
+++ b/spec/services/username_changer_spec.rb
@@ -597,9 +597,11 @@ RSpec.describe UsernameChanger do
<aside class="quote" data-post="#{quoted_post.post_number}" data-topic="#{quoted_post.topic.id}">
<div class="title">
<div class="quote-controls"></div>
- <img alt="" width="24" height="24" src="#{avatar_url}" class="avatar">
- <a href="#{protocol_relative_url(quoted_post.full_url)}">#{quoted_post.topic.title}</a>
- </div>
+ <img alt="" width="24" height="24" src="#{avatar_url}" class="avatar">
+ <div class="quote-title__text-content">
+ <a href="#{protocol_relative_url(quoted_post.full_url)}">#{quoted_post.topic.title}</a>
+ </div>
+ </div>
<blockquote>
quoted post
</blockquote>
@@ -608,9 +610,11 @@ RSpec.describe UsernameChanger do
<aside class="quote" data-post="#{quoted_post.post_number}" data-topic="#{quoted_post.topic.id}">
<div class="title">
<div class="quote-controls"></div>
- <img alt="" width="24" height="24" src="#{avatar_url}" class="avatar">
- <a href="#{protocol_relative_url(quoted_post.topic.url)}">#{quoted_post.topic.title}</a>
- </div>
+ <img alt="" width="24" height="24" src="#{avatar_url}" class="avatar">
+ <div class="quote-title__text-content">
+ <a href="#{protocol_relative_url(quoted_post.topic.url)}">#{quoted_post.topic.title}</a>
+ </div>
+ </div>
<blockquote>
quoted post
</blockquote>
@@ -628,7 +632,9 @@ RSpec.describe UsernameChanger do
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="#{avatar_url}" class="avatar">
- <a href="#{protocol_relative_url(quoted_post.full_url)}">#{quoted_post.topic.title}</a>
+ <div class="quote-title__text-content">
+ <a href="#{protocol_relative_url(quoted_post.full_url)}">#{quoted_post.topic.title}</a>
+ </div>
</div>
<blockquote>
quoted post
@@ -638,7 +644,9 @@ RSpec.describe UsernameChanger do
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="#{user_avatar_url(evil_trout)}" class="avatar">
- <a href="#{protocol_relative_url(another_quoted_post.full_url)}">#{another_quoted_post.topic.title}</a>
+ <div class="quote-title__text-content">
+ <a href="#{protocol_relative_url(another_quoted_post.full_url)}">#{another_quoted_post.topic.title}</a>
+ </div>
</div>
<blockquote>
evil post