discourse/app/assets/stylesheets/common/components/post-list.scss
Keegan George d886c55f63
DEV: Reusable post-list component (#30312)
This update adds a  _new_ `<PostList />` component, along with it's child components (`<PostListItem/>` and `<PostListItemDetails />`). This new generic component can be used to show a list of posts.

It can be used like so:
```js
/**
 * A component that renders a list of posts
 *
 * @component PostList
 *
 * @args {Array<Object>} posts - The array of post objects to display
 * @args {Function} fetchMorePosts - A function that fetches more posts. Must return a Promise that resolves to an array of new posts.
 * @args {String} emptyText (optional) - Custom text to display when there are no posts
 * @args {String|Array} additionalItemClasses (optional) - Additional classes to add to each post list item
 * @args {String} titleAriaLabel (optional) - Custom Aria label for the post title
 * 
*/
```
```hbs
<PostList
    @posts={{this.posts}}
    @fetchMorePosts={{this.loadMorePosts}}
    @emptyText={{i18n "custom_identifier.empty"}}
    @additionalItemClasses="custom-class"
 />
```
2024-12-19 09:20:25 -08:00

82 lines
1.4 KiB
SCSS

.post-list {
margin: 0;
.post-list-item {
background: var(--d-content-background, var(--secondary));
border-bottom: 1px solid var(--primary-low);
padding: 1em 0.53em;
list-style: none;
&.moderator-action {
background-color: var(--highlight-bg);
}
&.deleted {
background-color: var(--danger-low-mid);
}
&.hidden {
display: block;
opacity: 0.4;
}
&__header {
display: flex;
align-items: flex-start;
}
&__details {
flex-grow: 1;
min-width: 0;
.badge-category__wrapper {
width: 100%;
}
}
.stream-topic-title {
overflow-wrap: anywhere;
}
.relative-date {
line-height: var(--line-height-small);
color: var(--primary-medium);
font-size: var(--font-down-2);
padding-top: 5px;
}
}
.avatar-link {
margin-right: 0.5em;
}
.name {
font-size: var(--font-0);
max-width: 400px;
@include ellipsis;
}
.excerpt {
margin: 1em 0 0 0;
font-size: var(--font-0);
word-wrap: break-word;
color: var(--primary);
&:empty {
display: none;
}
details.disabled {
color: var(--primary-medium);
}
.emoji.only-emoji {
// oversized emoji break excerpt layout
// so we match inline emoji size
width: 20px;
height: 20px;
margin: 0;
}
}
.post-member-info {
display: flex;
}
}