I’m not exactly sure how to go about doing this and was looking for a bit of assistance.
Basically, I’d like to have visual separation between the pinned topics and regular topics. This would be for a game studio’s community forums and that separation would be helpful for the users.
What I’m looking for is something like this:
[PINNED] Topic Name
Regular topic
Instead of:
[PINNED] Topic Name
Regular topic
I’ve already changed the background colour of the pinned topics to create a slight difference between the two. I’ve tried CSS, which has worked, but only on a page refresh.
I’ve attempted creating my own theme component, but that’s where I’m getting stuck as I’d need to add something, but I’m not sure where.
My goal is to add before the original (regular topics) tbody.
You can look into using the Filtered Topic Lists theme component with the in:pinned query.
If you instead want to stick to CSS, you can do something like this:
// target the last pin in the list
tr.topic-list-item.pinned:has(+ tr:not(.pinned)) td {
// rough way to force space inside a table row
padding-bottom: 1.8em;
}
tr.topic-list-item.pinned:has(+ tr:not(.pinned))::after {
// content to display in the space if wanted
content: 'regular';
width: 100%;
position: absolute;
display: flex;
height: 1em;
left: 0;
right: 0;
bottom: 0;
justify-content: center;
border-top: 1px solid var(--primary-low);
}
Thanks for the help! Unfortunately, that didn’t work. I do have an attempt at a plugin that should do what I need it to do, but I can’t seem to get it working on Discourse 3.4.0-beta2.
Any assistance with this would be greatly appreciated!
You don’t need the components directory here in this connector and code context.
You can see it in my screenshot because I modified an existing component.
That said, it depends on what you want to do later. It’s also possible to create a component in the connector that refers to another component (and this one, you would place it in components directory).
I do have one last question, if you don’t mind. Is there a way to stop the pinned topics from appearing in the normal topic list so that the pinned topics aren’t duplicated?
Edit: I was actually able to do that with a bit of CSS.