mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-06 14:50:04 +01:00
feat: add new mixin clamp-fade, and handler for expanding it in category description
closes #13322
This commit is contained in:
@@ -111,6 +111,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use on elements with `line-clamp-*` classes
|
||||||
|
@mixin clamp-fade($lines) {
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.line-clamp-#{$lines}::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: calc(1.5em * ($lines - 2));
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 3em;
|
||||||
|
background: linear-gradient(180deg, transparent 0, $body-bg 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@for $i from 1 through 6 {
|
||||||
|
.clamp-fade-#{$i} {
|
||||||
|
@include clamp-fade($i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@each $color, $value in $grays {
|
@each $color, $value in $grays {
|
||||||
.border-gray-#{$color} {
|
.border-gray-#{$color} {
|
||||||
border-color: $value !important;
|
border-color: $value !important;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this does not look to be used anymore
|
||||||
.dropdown-backdrop {
|
.dropdown-backdrop {
|
||||||
background-color: rgba(0, 0, 0, .3);
|
background-color: rgba(0, 0, 0, .3);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ define('forum/category', [
|
|||||||
|
|
||||||
handleLoadMoreSubcategories();
|
handleLoadMoreSubcategories();
|
||||||
|
|
||||||
|
handleDescription();
|
||||||
|
|
||||||
categorySelector.init($('[component="category-selector"]'), {
|
categorySelector.init($('[component="category-selector"]'), {
|
||||||
privilege: 'find',
|
privilege: 'find',
|
||||||
parentCid: ajaxify.data.cid,
|
parentCid: ajaxify.data.cid,
|
||||||
@@ -113,6 +115,18 @@ define('forum/category', [
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDescription() {
|
||||||
|
const fadeEl = document.querySelector('.description.clamp-fade-4');
|
||||||
|
if (!fadeEl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fadeEl.addEventListener('click', () => {
|
||||||
|
const state = fadeEl.classList.contains('line-clamp-4');
|
||||||
|
fadeEl.classList.toggle('line-clamp-4', !state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Category.toTop = function () {
|
Category.toTop = function () {
|
||||||
navigator.scrollTop(0);
|
navigator.scrollTop(0);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user