Path: blob/master/src/packages/frontend/editors/task-editor/drag.tsx
1691 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/*6Drag tasks handle (and other support)7*/89import { Icon, Tip } from "../../components";10import { DragHandle as SortableDragHandle } from "@cocalc/frontend/components/sortable-list";1112interface Props {13id: string;14}1516function EnabledDragHandle({ id }: Props) {17return (18<SortableDragHandle id={id}>19<Icon name="bars" />20</SortableDragHandle>21);22}2324function DisabledDragHandle({}: Props) {25return (26<Tip27title={"Select Custom Order to enable dragging tasks."}28delayShow={700}29>30<Icon style={{ cursor: "pointer" }} name="bars" />31</Tip>32);33}3435interface Props {36sortable?: boolean;37}3839export const DragHandle: React.FC<Props> = ({ id, sortable }) => {40let color, Handle;41if (sortable) {42color = "#888";43Handle = EnabledDragHandle;44} else {45color = "#eee";46Handle = DisabledDragHandle;47}48return (49<span style={{ fontSize: "17pt", color, marginLeft: "15px" }}>50<Handle id={id} />51</span>52);53};545556