mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 20:32:27 +00:00
feat: Add peek animation and hide scrollbars in DM lists
- Add `.no-scrollbar` utility to hide scrollbars while keeping scrollability. - Apply `.no-scrollbar` to ConversationList and MessageThread containers. - Implement "peek" animation using `IntersectionObserver` to trigger only when the container becomes visible. - Ensure CSS build is updated with new utilities.
This commit is contained in:
1 parent
d989e09bdf
commit
e6da22249e
3 files changed
+659
-10
No files matched your search
@@ -139,7 +139,7 @@ export function MessageThread({
|
||||
|
||||
// Scroll to bottom and peek
|
||||
if (messages.length > 0) {
|
||||
setTimeout(() => {
|
||||
const animate = () => {
|
||||
timeline.scrollTop = timeline.scrollHeight;
|
||||
|
||||
if (timeline.scrollHeight > timeline.clientHeight) {
|
||||
@@ -155,7 +155,25 @@ export function MessageThread({
|
||||
}, 600);
|
||||
}, 600);
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
||||
if (typeof IntersectionObserver !== "undefined") {
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
const entry = entries[0];
|
||||
if (entry.isIntersecting) {
|
||||
observer.disconnect();
|
||||
// First ensure we are at bottom
|
||||
timeline.scrollTop = timeline.scrollHeight;
|
||||
setTimeout(animate, 300);
|
||||
}
|
||||
}, { threshold: 0.1 });
|
||||
observer.observe(timeline);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
timeline.scrollTop = timeline.scrollHeight;
|
||||
animate();
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
root.appendChild(timeline);
|
||||
|
||||
Reference in new issue
Block a user