- style tweaks
- container follows cursor
This commit is contained in:
cv
2021-05-20 13:42:53 +02:00
parent cc7b8278b8
commit 6ae0755696
2 changed files with 18 additions and 15 deletions
+12 -8
View File
@@ -75,9 +75,18 @@ export default function EventList(props) {
};
}, [socket]);
// attach cursor to selected
useEffect(() => {
if (cursorSettings !== 'locked' || selected == null) return;
if (selected.index == null) return;
setCursor(selected.index);
}, [selected, cursorSettings]);
// attach scroll to cursor
useEffect(() => {
if (cursor == null || cursorRef.current == null) return;
console.log('debug cursor scrolling');
cursorRef.current.scrollIntoView({
behavior: 'smooth',
@@ -86,13 +95,6 @@ export default function EventList(props) {
});
}, [cursor, cursorRef]);
useEffect(() => {
if (cursorSettings !== 'locked' || selected == null) return;
if (selected.index == null) return;
setCursor(selected.index);
}, [selected, cursorSettings]);
if (events.length < 1) {
return <Empty text='No Events' />;
}
@@ -129,14 +131,16 @@ export default function EventList(props) {
ref={provided.innerRef}
>
{events.map((e, index) => {
let isCursor = cursor === index;
if (index === 0) cumulativeDelay = 0;
if (e.type === 'delay' && e.duration != null) {
cumulativeDelay += e.duration;
} else if (e.type === 'block') cumulativeDelay = 0;
return (
<div
ref={isCursor ? cursorRef : undefined}
key={e.id}
className={cursor === index ? style.cursor : 'undefined'}
className={isCursor ? style.cursor : undefined}
>
<EventListItem
type={e.type}
@@ -24,12 +24,11 @@
width: 100%;
background: linear-gradient(
180deg,
#ff7597 0%,
#0000 10%,
#0000 90%,
#ff7597 100%
#ff7597 2%,
#0001 3%,
#0001 97%,
#ff7597 98%
);
border-radius: 20px;
transition: 0.3s;
transition-property: all;
border-radius: 14px;
}