discourse/app/assets/stylesheets/common/components/badges.scss

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

237 lines
4.4 KiB
SCSS
Raw Normal View History

2013-02-06 03:16:51 +08:00
// --------------------------------------------------
// Badges
// --------------------------------------------------
// Base
// --------------------------------------------------
%badge {
display: inline-block;
font-weight: normal;
2013-02-06 03:16:51 +08:00
white-space: nowrap;
2018-07-13 04:38:51 +08:00
border-radius: 10px;
2013-02-06 03:16:51 +08:00
}
2015-03-05 11:15:21 +08:00
// Category badges
2013-02-06 03:16:51 +08:00
// --------------------------------------------------
2015-03-05 11:15:21 +08:00
.badge-wrapper {
2018-01-13 06:27:38 +08:00
font-size: $font-down-1;
white-space: nowrap;
position: relative;
display: inline-flex;
align-items: baseline;
.badge-category {
display: inline-flex;
align-items: baseline;
.category-name {
text-overflow: ellipsis;
overflow: hidden;
}
.d-icon {
margin-right: 3px;
width: 0.74em;
height: 0.74em;
color: inherit;
}
}
2015-01-29 14:34:05 +08:00
// ----- Bullet
&.bullet {
margin-right: 12px;
2015-03-10 00:25:27 +08:00
span.badge-category {
2018-12-08 09:01:38 +08:00
color: $primary-high;
overflow: hidden;
text-overflow: ellipsis;
2015-03-10 00:25:27 +08:00
.extra-info-wrapper & {
color: $header-primary;
2015-03-10 00:25:27 +08:00
}
}
.badge-category-parent-bg,
.badge-category-bg {
flex: 0 0 auto;
width: 9px;
height: 9px;
margin-right: 5px;
display: inline-block;
}
.badge-category-parent-bg {
// Subcategories
width: 5px;
margin-right: 0;
+ .badge-category-bg {
width: 5px;
}
}
.d-icon {
color: $primary-medium;
}
}
2015-03-10 00:25:27 +08:00
// ----- Box
2015-03-10 00:25:27 +08:00
&.box {
2015-04-15 03:54:17 +08:00
margin-right: 5px;
2018-02-03 10:29:51 +08:00
padding: 2px 4px 2px 4px;
display: inline-flex;
span {
overflow: hidden;
text-overflow: ellipsis;
&.badge-category-bg,
&.badge-category-parent-bg {
2015-03-05 11:15:21 +08:00
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
2015-03-05 11:15:21 +08:00
}
&.badge-category-parent-bg {
// Subcategories
2015-03-05 11:15:21 +08:00
width: calc(100% - 5px);
& + .badge-category-bg {
left: 5px;
width: calc(100% - 5px);
& + .badge-category {
margin-left: 5px;
}
}
}
&.badge-category {
position: relative;
}
}
+ .topic-header-extra {
padding: 2px 4px 2px 4px;
}
}
// ----- Bar
&.bar {
margin-right: 5px;
span.badge-category {
2018-12-08 09:01:38 +08:00
color: $primary-high;
padding: 1px 3px;
overflow: hidden;
text-overflow: ellipsis;
.extra-info-wrapper & {
color: $header-primary;
}
}
.badge-category-parent-bg,
.badge-category-bg {
// Subcategories
display: inline-block;
padding: 0 1px;
&:before {
content: "\a0";
2015-03-05 11:15:21 +08:00
}
}
}
2015-01-30 14:57:46 +08:00
// ----- No category style
&.none {
2018-12-08 09:01:38 +08:00
color: $primary-high;
margin-right: 5px;
}
}
2015-03-05 11:15:21 +08:00
// Category badge dropdown
// --------------------------------------------------
2015-03-05 11:15:21 +08:00
.list-controls {
.category-breadcrumb {
a.badge-category {
2015-03-05 11:15:21 +08:00
display: inline-block;
2018-01-13 06:27:38 +08:00
padding: 6px 8px;
line-height: $line-height-medium;
2015-03-05 11:15:21 +08:00
}
2015-01-29 14:48:55 +08:00
}
}
2013-02-06 03:16:51 +08:00
// Notification badge
// --------------------------------------------------
.badge-notification {
@extend %badge;
2019-01-18 04:46:55 +08:00
padding: 0.21em 0.42em;
min-width: 0.5em;
2014-07-26 11:06:14 +08:00
color: $secondary;
2018-01-13 06:27:38 +08:00
font-size: $font-down-2;
line-height: $line-height-small;
2013-08-03 03:41:02 +08:00
text-align: center;
2017-10-11 04:07:46 +08:00
background-color: dark-light-choose($primary-low-mid, $secondary-low);
2013-02-06 03:16:51 +08:00
&[href] {
color: $secondary;
2013-02-06 03:16:51 +08:00
}
&:hover {
color: $secondary;
}
// New posts
2013-02-06 03:16:51 +08:00
&.new-posts,
&.unread-posts {
2017-10-11 04:07:46 +08:00
background-color: dark-light-choose($tertiary-medium, $tertiary);
color: dark-light-choose($secondary, $secondary);
2015-08-19 03:28:58 +08:00
font-weight: dark-light-choose(normal, bold);
2013-02-06 03:16:51 +08:00
}
&.new-topic {
background-color: transparent;
2017-10-11 04:07:46 +08:00
color: $tertiary-high;
font-weight: normal;
2018-01-13 06:27:38 +08:00
font-size: $font-down-1;
}
2014-09-04 04:33:56 +08:00
&.new-topic::before {
2014-09-04 09:07:15 +08:00
content: "";
margin-right: 2px;
2014-09-04 04:33:56 +08:00
}
2013-02-06 03:16:51 +08:00
// Click count
&.clicks {
font-weight: normal;
2017-06-12 10:20:14 +08:00
background-color: $primary-low;
top: -1px;
2017-06-12 10:20:14 +08:00
color: $primary-medium;
2013-11-18 11:32:58 +08:00
position: relative;
2014-07-26 00:22:55 +08:00
border: none;
2013-02-06 03:16:51 +08:00
}
}
// Posts badge
// --------------------------------------------------
.badge-posts {
font-weight: normal;
2018-01-13 06:27:38 +08:00
font-size: $font-0;
line-height: $line-height-small;
2013-02-06 03:16:51 +08:00
&[href] {
2017-10-11 04:07:46 +08:00
color: dark-light-choose($primary-medium, $secondary-medium);
2013-02-06 03:16:51 +08:00
}
}
// Group badge
// --------------------------------------------------
.badge-group {
@extend %badge;
padding: 2px 5px;
color: $primary;
2017-06-12 10:20:14 +08:00
background-color: $primary-low;
border-color: $primary-low;
2018-01-13 06:27:38 +08:00
font-size: $font-down-1;
}