mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 04:13:47 +00:00
45 lines
1.3 KiB
React
45 lines
1.3 KiB
React
import { Draggable } from 'react-beautiful-dnd';
|
|
import { FiMoreVertical } from 'react-icons/fi';
|
|
import DeleteIconBtn from '../../../common/components/buttons/DeleteIconBtn';
|
|
import ActionButtons from './ActionButtons';
|
|
import style from './Block.module.css';
|
|
|
|
export default function BlockBlock(props) {
|
|
const { eventsHandler, index, data } = props;
|
|
|
|
const addHandler = () => {
|
|
eventsHandler('add', { type: 'event', order: index + 1 });
|
|
};
|
|
const deleteHandler = () => {
|
|
eventsHandler('delete', data.id);
|
|
};
|
|
const delayHandler = () => {
|
|
eventsHandler('add', { type: 'delay', order: index + 1 });
|
|
};
|
|
|
|
return (
|
|
<Draggable key={data.id} draggableId={data.id} index={index}>
|
|
{(provided) => (
|
|
<div
|
|
className={style.block}
|
|
{...provided.draggableProps}
|
|
ref={provided.innerRef}
|
|
>
|
|
<span className={style.drag} {...provided.dragHandleProps}>
|
|
<FiMoreVertical />
|
|
</span>
|
|
<div className={style.actionOverlay}>
|
|
<DeleteIconBtn clickhandler={deleteHandler} />
|
|
<ActionButtons
|
|
showAdd
|
|
addHandler={addHandler}
|
|
showDelay
|
|
delayHandler={delayHandler}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</Draggable>
|
|
);
|
|
}
|