Path: blob/master/src/packages/frontend/editors/task-editor/min-toggle.tsx
1691 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/*6Toggle to minimize display of a task (just show first part or everything)7*/89import { CSS, React } from "../../app-framework";10import { Icon } from "../../components";11import { TaskActions } from "./actions";1213const STYLE: CSS = { fontSize: "17pt", color: "#888", float: "right" } as const;1415interface Props {16actions?: TaskActions;17task_id: string;18hideBody?: boolean;19has_body: boolean;20}2122export const MinToggle: React.FC<Props> = React.memo(23({ actions, task_id, hideBody, has_body }) => {24if (actions == null) {25// no support for toggling (e.g., read-only history view)26return <span />;27}28if (has_body) {29return (30<span31onClick={() => {32actions.toggleHideBody(task_id);33}}34style={STYLE}35>36{has_body ? (37<Icon name={hideBody ? "caret-right" : "caret-down"} />38) : (39<Icon name={"caret-right"} />40)}41</span>42);43} else {44return <span />;45}46}47);484950