A platform for community discussion. Free, open, simple.
DEV: Make styling bookmarks easier (#31979)
Jordan Vidrinefe19a0aa0c24
diff --git a/app/assets/javascripts/discourse/app/components/bookmark-list.gjs b/app/assets/javascripts/discourse/app/components/bookmark-list.gjsindex ce9aa28027a..17ff2685874 100644--- a/app/assets/javascripts/discourse/app/components/bookmark-list.gjs+++ b/app/assets/javascripts/discourse/app/components/bookmark-list.gjs@@ -17,6 +17,7 @@ import PluginOutlet from "discourse/components/plugin-outlet";import TopicStatus from "discourse/components/topic-status";import avatar from "discourse/helpers/avatar";import categoryLink from "discourse/helpers/category-link";+import concatClass from "discourse/helpers/concat-class";import icon from "discourse/helpers/d-icon";import discourseTags from "discourse/helpers/discourse-tags";import formatDate from "discourse/helpers/format-date";@@ -274,7 +275,13 @@ export default class BookmarkList extends Component {</thead><tbody class="topic-list-body">{{#each this.content as |bookmark|}}- <tr class="topic-list-item bookmark-list-item">+ <tr+ class={{concatClass+ "topic-list-item bookmark-list-item"+ (if bookmark.excerpt "excerpt-expanded" "")+ (if bookmark.hasMetadata "has-metadata" "")+ }}+ >{{#if this.bulkSelectEnabled}}<td class="bulk-select bookmark-list-data"><label for="bulk-select-{{bookmark.id}}">@@ -294,24 +301,26 @@ export default class BookmarkList extends Component {/><span class="link-top-line">- <div class="bookmark-metadata">- {{#if bookmark.reminder_at}}- <span- class="bookmark-metadata-item bookmark-reminder- {{if- bookmark.reminderAtExpired- 'bookmark-expired-reminder'- }}"- >- {{icon "far-clock"}}{{bookmark.formattedReminder}}- </span>- {{/if}}- {{#if bookmark.name}}- <span class="bookmark-metadata-item">- {{icon "circle-info"}}<span>{{bookmark.name}}</span>- </span>- {{/if}}- </div>+ {{#if bookmark.hasMetadata}}+ <div class="bookmark-metadata">+ {{#if bookmark.reminder_at}}+ <span+ class="bookmark-metadata-item bookmark-reminder+ {{if+ bookmark.reminderAtExpired+ 'bookmark-expired-reminder'+ }}"+ >+ {{icon "far-clock"}}{{bookmark.formattedReminder}}+ </span>+ {{/if}}+ {{#if bookmark.name}}+ <span class="bookmark-metadata-item">+ {{icon "circle-info"}}<span>{{bookmark.name}}</span>+ </span>+ {{/if}}+ </div>+ {{/if}}<div class="bookmark-status-with-link">{{#if bookmark.pinned}}{{icon "thumbtack" class="bookmark-pinned"}}@@ -358,16 +367,18 @@ export default class BookmarkList extends Component {avatarTemplatePath="avatar_template"usernamePath="username"namePath="name"- imageSize="small"+ imageSize="large"}}</a>{{/if}}{{! template-lint-disable no-invalid-interactive }}- <p- class="post-excerpt"- {{on "click" this.screenExcerptForExternalLink}}- >{{htmlSafe bookmark.excerpt}}</p>+ {{#if bookmark.excerpt}}+ <p+ class="post-excerpt"+ {{on "click" this.screenExcerptForExternalLink}}+ >{{htmlSafe bookmark.excerpt}}</p>+ {{/if}}</td>{{#if this.site.desktopView}}<td class="author-avatar topic-list-data">@@ -382,7 +393,7 @@ export default class BookmarkList extends Component {avatarTemplatePath="avatar_template"usernamePath="username"namePath="name"- imageSize="small"+ imageSize="large"}}</a>{{/if}}diff --git a/app/assets/javascripts/discourse/app/models/bookmark.js b/app/assets/javascripts/discourse/app/models/bookmark.jsindex 192e0dc1b52..31f6d706f73 100644--- a/app/assets/javascripts/discourse/app/models/bookmark.js+++ b/app/assets/javascripts/discourse/app/models/bookmark.js@@ -216,4 +216,9 @@ export default class Bookmark extends RestModel {bookmarkableTopicAlike(bookmarkable_type) {return ["Topic", "Post"].includes(bookmarkable_type);}++ @discourseComputed("reminder_at", "name")+ hasMetadata() {+ return this.reminder_at || this.name;+ }}diff --git a/app/assets/stylesheets/common/components/bookmark-list.scss b/app/assets/stylesheets/common/components/bookmark-list.scssindex 82d0a30a90a..dbb07642ff1 100644--- a/app/assets/stylesheets/common/components/bookmark-list.scss+++ b/app/assets/stylesheets/common/components/bookmark-list.scss@@ -17,6 +17,11 @@ $mobile-breakpoint: 700px;}}+ .author-avatar img.avatar {+ height: 24px;+ width: 24px;+ }+.main-link.topic-list-data {.bookmark-status-with-link {a.title {