CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/components/mark-all.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2023 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { capitalize } from "@cocalc/util/misc";
7
import { Button } from "antd";
8
import { SizeType } from "antd/lib/config-provider/SizeContext";
9
import { Icon } from "./icon";
10
11
interface Props {
12
how: string;
13
onClick: (how: string) => void;
14
size?: SizeType;
15
}
16
17
export function MarkAll({ how, onClick, size }: Props) {
18
function icon() {
19
switch (how) {
20
case "read":
21
case "seen":
22
return <Icon name="check-square" />;
23
case "unread":
24
case "unseen":
25
return <Icon name="square" />;
26
default:
27
undefined;
28
}
29
}
30
31
return (
32
<Button
33
onClick={(e) => {
34
e.preventDefault();
35
e.stopPropagation();
36
onClick(how);
37
}}
38
size={size}
39
>
40
<>
41
{icon()} Mark all {capitalize(how)}
42
</>
43
</Button>
44
);
45
}
46
47