mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
This PR started mainly to apply styling changes to remain consistent with its sister TopicVoting plugin: #39234 Inevitably, this also lead to some refactoring as there was still a lot legacy in use in this plugin. In this commit: - Rewrote styles using BEM conventions, trimming down from 9 > 4 BlockElements, and spacing variables - Consolidated `common`/`mobile`/`desktop` stylesheets into a single responsive sheet using `viewport` mixins - Replaced the custom comments popup with `DMenu` - Swapped `angle-up` icons for `vote-up` / `vote-up-filled` - Updated sort controls to match standard navigation styling pills and to refresh in place - Updated character counter for composer to use standard counter - Added a zero-upvotes, to maintain alignment in comments - Refined styling for sizing, font-colours, spacing,… - Cleaned up class names and wrapper markup - Fixed missing accessibility by adding aria-labels, titles, and translation strings for vote buttons, comment actions, and the "show who voted" toggle Note: Nothing in the all-the-themes repo customises this, except for one third-party, which has been notified of the refactor. Unity needs some class changes (done [here](https://github.com/discourse/discourse-unity-theme/pull/83)) . ### Desktop | BC | AC | |--------|--------| | <img width="1348" height="1624" alt="CleanShot 2026-04-22 at 11 44 21@2x" src="https://github.com/user-attachments/assets/608c1e37-72a9-461a-b873-cb494c491a8e" /> | <img width="1438" height="1614" alt="CleanShot 2026-04-22 at 11 40 39@2x" src="https://github.com/user-attachments/assets/9b3437c8-c2ad-47cb-a06a-fd259e461455" /> | | <img width="1348" height="1624" alt="CleanShot 2026-04-22 at 11 45 27@2x" src="https://github.com/user-attachments/assets/499cf9f4-4b89-433a-b5ff-517a651b945f" /> | <img width="1438" height="1610" alt="CleanShot 2026-04-22 at 11 41 30@2x" src="https://github.com/user-attachments/assets/99e98fa3-0372-4b1b-ba66-5d8b188559b6" /> | ### Mobile | BC | AC | |--------|--------| | <img width="1179" height="2556" alt="image" src="https://github.com/user-attachments/assets/94cc8e9c-06c2-42bd-9fca-b8605557452b" /> | <img width="1179" height="2556" alt="image" src="https://github.com/user-attachments/assets/5f2d3b65-7c78-422d-b603-a9b1d498c619" /> |
324 lines
5.4 KiB
SCSS
Vendored
324 lines
5.4 KiB
SCSS
Vendored
@use "lib/viewport";
|
|
|
|
.post-voting-topic {
|
|
.time-gap,
|
|
.topic-post-visited-line,
|
|
.timeline-date-wrapper,
|
|
.timeline-last-read,
|
|
.timeline-ago {
|
|
display: none;
|
|
}
|
|
|
|
.time-gap + .topic-post,
|
|
.topic-post-visited + .topic-post {
|
|
.topic-avatar,
|
|
.topic-body {
|
|
border-top: 1px solid var(--primary-low);
|
|
}
|
|
}
|
|
|
|
.posts-filtered-notice:empty {
|
|
display: none;
|
|
}
|
|
|
|
@include viewport.until(sm) {
|
|
.topic-body .cooked {
|
|
margin-left: calc(48px + var(--space-2));
|
|
}
|
|
}
|
|
}
|
|
|
|
.post-voting-answers-header {
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
align-items: center;
|
|
margin-top: var(--space-4);
|
|
|
|
@include viewport.until(sm) {
|
|
margin-bottom: var(--space-4);
|
|
}
|
|
|
|
@include viewport.from(sm) {
|
|
width: 100%;
|
|
}
|
|
|
|
&__count {
|
|
margin: 0;
|
|
font-size: var(--font-0);
|
|
}
|
|
|
|
&__sort {
|
|
margin: 0;
|
|
margin-left: auto;
|
|
|
|
.rtl & {
|
|
margin-right: auto;
|
|
}
|
|
}
|
|
|
|
.--votes,
|
|
.--activity {
|
|
font-size: var(--font-down-1-rem);
|
|
}
|
|
}
|
|
|
|
.post-voting-comments {
|
|
margin-top: var(--space-1);
|
|
|
|
&__comment {
|
|
font-size: var(--font-down-1-rem);
|
|
border-top: 1px solid var(--primary-low);
|
|
display: flex;
|
|
align-items: flex-start;
|
|
padding: var(--space-3) 0;
|
|
word-break: break-word;
|
|
|
|
&.--deleted {
|
|
background-color: var(--danger-low);
|
|
}
|
|
|
|
&:hover:not(.--deleted) .post-voting-comments__comment-actions {
|
|
display: inline-block;
|
|
}
|
|
}
|
|
|
|
&__comment-cooked {
|
|
p {
|
|
display: inline;
|
|
}
|
|
}
|
|
|
|
&__vote {
|
|
margin-right: var(--space-2);
|
|
display: inline-flex;
|
|
align-items: center;
|
|
|
|
.post-voting-button {
|
|
font-size: var(--font-up-1);
|
|
padding: 0;
|
|
|
|
.d-icon {
|
|
color: var(--primary-low-mid);
|
|
}
|
|
|
|
&.--voted {
|
|
.d-icon {
|
|
color: var(--success);
|
|
}
|
|
}
|
|
|
|
&:focus-visible,
|
|
.discourse-no-touch &:hover {
|
|
.d-icon {
|
|
color: var(--primary-high);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
&__vote-count {
|
|
color: var(--primary-high);
|
|
min-width: 3ch;
|
|
text-align: center;
|
|
|
|
&.--none {
|
|
color: var(--primary-low-mid);
|
|
}
|
|
}
|
|
|
|
&__separator {
|
|
margin: 0 var(--space-1);
|
|
}
|
|
|
|
&__username {
|
|
display: inline;
|
|
margin-right: var(--space-1);
|
|
|
|
&.--deleted {
|
|
color: var(--primary-med-or-secondary-med);
|
|
}
|
|
}
|
|
|
|
&__created {
|
|
color: var(--primary-med-or-secondary-med);
|
|
}
|
|
|
|
&__comment-actions {
|
|
display: none;
|
|
margin-left: var(--space-1);
|
|
}
|
|
|
|
&__comment-actions-edit-link,
|
|
&__comment-actions-delete-link,
|
|
&__comment-actions-flag-link {
|
|
padding: 0 var(--space-1);
|
|
height: 100%;
|
|
}
|
|
|
|
&__comment-actions-delete-link:hover,
|
|
&__comment-actions-flag-link:hover {
|
|
.discourse-no-touch & {
|
|
color: var(--danger) !important;
|
|
}
|
|
}
|
|
|
|
&__comment-editor {
|
|
margin: var(--space-2) 0;
|
|
width: 100%;
|
|
|
|
textarea {
|
|
width: 100%;
|
|
margin-bottom: 0;
|
|
font-size: var(--font-down-1-rem);
|
|
}
|
|
}
|
|
|
|
&__comment-editor-cancel {
|
|
margin-left: var(--space-2);
|
|
}
|
|
|
|
&__composer {
|
|
width: 100%;
|
|
position: relative;
|
|
}
|
|
|
|
&__composer-textarea {
|
|
width: 100%;
|
|
margin: var(--space-2) 0;
|
|
}
|
|
|
|
&__composer-flash {
|
|
position: absolute;
|
|
bottom: 0;
|
|
right: 0;
|
|
display: inline-block;
|
|
width: auto;
|
|
margin: 0;
|
|
transform: translateY(+50%);
|
|
color: var(--primary-medium);
|
|
font-size: var(--font-down-1-rem);
|
|
|
|
&.has-error {
|
|
color: var(--danger);
|
|
}
|
|
}
|
|
|
|
&__composer-add {
|
|
font-size: var(--font-down-1);
|
|
margin: 0;
|
|
}
|
|
|
|
&__actions {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
}
|
|
|
|
.post-voting-post {
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
margin-top: var(--space-2);
|
|
|
|
@include viewport.until(sm) {
|
|
position: absolute;
|
|
left: 0;
|
|
top: var(--space-11);
|
|
width: var(--space-11);
|
|
}
|
|
|
|
.post-voting-button {
|
|
padding: var(--space-half) var(--space-1);
|
|
color: var(--primary-low-mid);
|
|
|
|
.d-icon {
|
|
color: inherit;
|
|
}
|
|
|
|
&.--downvote {
|
|
.d-icon {
|
|
transform: rotate(180deg);
|
|
}
|
|
}
|
|
|
|
&:focus-visible,
|
|
.discourse-no-touch &:hover {
|
|
.d-icon {
|
|
color: var(--primary-high);
|
|
}
|
|
}
|
|
|
|
&.--voted {
|
|
.d-icon {
|
|
color: var(--success);
|
|
}
|
|
|
|
&.--downvote {
|
|
.d-icon {
|
|
color: var(--danger);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
&__toggle-voters {
|
|
font-size: var(--font-down-1);
|
|
padding: var(--space-half) var(--space-2);
|
|
text-align: center;
|
|
color: var(--primary-high);
|
|
}
|
|
}
|
|
|
|
// DMenu
|
|
.post-voting-popup-content {
|
|
.fk-d-menu__inner-content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: var(--space-2) var(--space-3);
|
|
width: max-content;
|
|
max-width: 90vw;
|
|
}
|
|
|
|
&__wrapper {
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: var(--space-3);
|
|
|
|
// &:first-child {
|
|
// padding-bottom: var(--space-2);
|
|
// }
|
|
&:nth-child(2) {
|
|
border-top: 1px solid var(--primary-low);
|
|
padding-top: var(--space-2);
|
|
margin-top: var(--space-2);
|
|
}
|
|
}
|
|
|
|
&__voters {
|
|
.small-user-list-content {
|
|
gap: var(--space-1);
|
|
justify-content: flex-start;
|
|
}
|
|
}
|
|
|
|
&__count {
|
|
color: var(--primary-high);
|
|
}
|
|
|
|
&__icon {
|
|
&.--upvote {
|
|
.d-icon {
|
|
color: var(--success);
|
|
}
|
|
}
|
|
|
|
&.--downvote {
|
|
.d-icon {
|
|
color: var(--danger);
|
|
transform: rotate(180deg);
|
|
}
|
|
}
|
|
}
|
|
}
|