discourse/app/assets/stylesheets/common/components/badges.scss
Keegan George 71f808dea9
Some checks failed
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
Migration Tests / Tests with Ruby ${{ matrix.ruby }} (3.3) (push) Has been cancelled
DEV: Improve method of presenting link clicks (#29453)
Currently the tracking for clicked links are injected into the HTML in a span tag. This leads to the link counter value being highlighted when copying and pasting. Additionally, any means for using CSS to hide link counters result in a gap due to it occupying a specific width.

With this change, we make link counters appear in a data attribute on the link element and visually shown with CSS `::after` element.
2024-10-31 12:44:08 -07:00

140 lines
2.8 KiB
SCSS

// --------------------------------------------------
// Badges
// --------------------------------------------------
// Base
// --------------------------------------------------
%badge {
display: inline-block;
font-weight: normal;
white-space: nowrap;
border-radius: 10px;
}
// Category badges
// --------------------------------------------------
.badge-category__wrapper {
color: var(--primary-high);
overflow: hidden;
text-overflow: ellipsis;
font-size: var(--font-down-1);
white-space: nowrap;
position: relative;
display: inline-flex;
align-items: baseline;
.badge-category {
display: inline-flex;
align-items: baseline;
gap: 0.33em;
color: var(--primary-high);
min-width: 0;
&:before {
content: "";
background: var(--category-badge-color);
flex: 0 0 auto;
width: 0.625rem; // fixed dimensions (10px square)
height: 0.625rem;
}
&__name {
color: currentColor;
text-overflow: ellipsis;
overflow: hidden;
min-width: 0;
}
&.--has-parent {
&:before {
background: linear-gradient(
90deg,
var(--parent-category-badge-color) 50%,
var(--category-badge-color) 50%
);
}
}
.extra-info-wrapper & {
color: var(--header_primary-high);
}
}
.d-icon {
width: 0.74em;
height: 0.74em;
color: var(--primary-medium);
}
}
// Notification badge
// --------------------------------------------------
.badge-notification {
@extend %badge;
position: relative;
top: -2px;
padding: 0.21em 0.42em;
min-width: 0.5em;
color: var(--secondary);
font-size: var(--font-down-2);
line-height: var(--line-height-small);
text-align: center;
background-color: var(--primary-low-mid-or-secondary-low);
&[href] {
color: var(--secondary);
}
&:hover {
color: var(--secondary);
}
// Unread posts
&.unread-posts {
background-color: var(--tertiary-med-or-tertiary);
color: var(--secondary);
font-weight: dark-light-choose(normal, bold);
}
&.new-topic {
background-color: transparent;
padding-left: 0.15em;
}
&.new-topic::before {
content: "";
background: var(--tertiary-med-or-tertiary);
display: inline-block;
height: 8px;
width: 8px;
border-radius: 50%;
}
}
// Posts badge
// --------------------------------------------------
.badge-posts {
font-weight: normal;
font-size: var(--font-0);
line-height: var(--line-height-small);
&[href] {
color: var(--primary-med-or-secondary-med);
}
}
// Group badge
// --------------------------------------------------
.badge-group {
@extend %badge;
padding: 2px 5px;
color: var(--primary);
background-color: var(--primary-low);
border-color: var(--primary-low);
font-size: var(--font-down-1);
}