mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-25 08:59:13 +00:00
style: cursor
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
import style from './List.module.css';
|
import style from './List.module.css';
|
||||||
import { createRef, Fragment, useEffect, useMemo, useState } from 'react';
|
import { createRef, useEffect, useMemo, useState } from 'react';
|
||||||
import { useSocket } from 'app/context/socketContext';
|
import { useSocket } from 'app/context/socketContext';
|
||||||
import tinykeys from 'tinykeys';
|
import tinykeys from 'tinykeys';
|
||||||
import Empty from 'common/state/Empty';
|
import Empty from 'common/state/Empty';
|
||||||
import EventListItem from './EventListItem';
|
import EventListItem from './EventListItem';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
|
||||||
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { SelectSetting } from 'app/context/settingsAtom';
|
import { SelectSetting } from 'app/context/settingsAtom';
|
||||||
@@ -94,22 +93,6 @@ export default function EventList(props) {
|
|||||||
return <Empty text='No Events' />;
|
return <Empty text='No Events' />;
|
||||||
}
|
}
|
||||||
|
|
||||||
// motion
|
|
||||||
const cursorVariants = {
|
|
||||||
hidden: {
|
|
||||||
scale: 0,
|
|
||||||
},
|
|
||||||
visible: {
|
|
||||||
scale: 1,
|
|
||||||
transition: {
|
|
||||||
duration: 0.3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exit: {
|
|
||||||
scale: 0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// DND
|
// DND
|
||||||
const handleOnDragEnd = (result) => {
|
const handleOnDragEnd = (result) => {
|
||||||
// drop outside of area
|
// drop outside of area
|
||||||
@@ -131,18 +114,6 @@ export default function EventList(props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.eventContainer}>
|
<div className={style.eventContainer}>
|
||||||
<AnimatePresence>
|
|
||||||
{cursor === -1 && (
|
|
||||||
<motion.div
|
|
||||||
ref={cursorRef}
|
|
||||||
className={style.cursor}
|
|
||||||
variants={cursorVariants}
|
|
||||||
initial='hidden'
|
|
||||||
animate='visible'
|
|
||||||
exit='exit'
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</AnimatePresence>
|
|
||||||
<DragDropContext onDragEnd={handleOnDragEnd}>
|
<DragDropContext onDragEnd={handleOnDragEnd}>
|
||||||
<Droppable droppableId='eventlist'>
|
<Droppable droppableId='eventlist'>
|
||||||
{(provided) => (
|
{(provided) => (
|
||||||
@@ -157,7 +128,10 @@ export default function EventList(props) {
|
|||||||
cumulativeDelay += e.duration;
|
cumulativeDelay += e.duration;
|
||||||
} else if (e.type === 'block') cumulativeDelay = 0;
|
} else if (e.type === 'block') cumulativeDelay = 0;
|
||||||
return (
|
return (
|
||||||
<Fragment key={e.id}>
|
<div
|
||||||
|
key={e.id}
|
||||||
|
className={cursor === index ? style.cursor : 'undefined'}
|
||||||
|
>
|
||||||
<EventListItem
|
<EventListItem
|
||||||
type={e.type}
|
type={e.type}
|
||||||
index={index}
|
index={index}
|
||||||
@@ -167,19 +141,7 @@ export default function EventList(props) {
|
|||||||
eventsHandler={eventsHandler}
|
eventsHandler={eventsHandler}
|
||||||
delay={cumulativeDelay}
|
delay={cumulativeDelay}
|
||||||
/>
|
/>
|
||||||
<AnimatePresence>
|
</div>
|
||||||
{cursor === index && (
|
|
||||||
<motion.div
|
|
||||||
ref={cursorRef}
|
|
||||||
className={style.cursor}
|
|
||||||
variants={cursorVariants}
|
|
||||||
initial='hidden'
|
|
||||||
animate='visible'
|
|
||||||
exit='exit'
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</AnimatePresence>
|
|
||||||
</Fragment>
|
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{provided.placeholder}
|
{provided.placeholder}
|
||||||
|
|||||||
@@ -21,11 +21,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.cursor {
|
.cursor {
|
||||||
width: 90%;
|
width: 100%;
|
||||||
min-height: 2px;
|
background: linear-gradient(
|
||||||
background-color: #ff7597;
|
180deg,
|
||||||
border-radius: 2px;
|
#ff7597 0%,
|
||||||
margin: 0 auto;
|
#0000 10%,
|
||||||
/* transition: 1s;
|
#0000 90%,
|
||||||
transition-property: all; */
|
#ff7597 100%
|
||||||
|
);
|
||||||
|
border-radius: 20px;
|
||||||
|
transition: 0.3s;
|
||||||
|
transition-property: all;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user