New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEATURE: remove alternative category badge styles, set bullet style as default #24198
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…iscourse into category-bullet-only
This was referenced Nov 2, 2023
oblakeerickson
approved these changes
Nov 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details and additional discussion have been posted to https://meta.discourse.org/t/moving-to-a-single-category-style-site-setting/282441
Goal
Once merged, this will eliminate the site setting
category style
which would allow admins to selectbullet
,box
,bar
, ornone
category badge styles.The default for this setting was
bullet
, and this will now be the only style included in Discourse core (as seen below).A theme component that allows for the other styles has been created for admins who wish to remain on the other styles: https://github.com/discourse/discourse-category-badge-styles
Details
At this point there’s no HTML structure to the bullet portion of the badge, it’s all displayed with CSS…
The markup for a parent category:
The markup for a child category:
How this works:
Each
.badge-category
gets data attributes forcategory-id
andparent-category-id
category-badge-css-generator.js produces CSS for each badge, in the form of custom properties:
These custom properties are scoped to
.badge-category
based on the data attribute:If there’s a parent category, the badge is split using a CSS gradient. Parents get a .--has-parent modifier class that applies this:
This applies to all category badges, except for:
Sidebar/navigation categories
These are structured differently because the sidebar calls for a prefix for each link. This special case makes sense given the API for adding sidebar links. Sharing classes and styles with these is more complicated than it's worth at the moment.
Hashtag mentions in posts
Mentions are similar to the sidebar where they all share a structure and API, so this is another case where these are a different "organism" in a sense.
Things to update after this is merged
This PR also adjusts some padding and spacing for consistency, and removes a bunch of style-specific CSS.
Once merged this will rely on updates to: