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/close-x.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import React from "react";
7
import { Icon } from "./icon";
8
9
const closex_style: React.CSSProperties = {
10
float: "right",
11
marginLeft: "5px",
12
} as const;
13
14
interface Props {
15
on_close: () => void;
16
style?: React.CSSProperties;
17
}
18
19
export const CloseX: React.FC<Props> = (props: Props) => {
20
const { on_close, style } = props;
21
22
function onClick(e) {
23
e?.preventDefault();
24
on_close();
25
}
26
27
return (
28
<a href="" style={{ ...closex_style, ...style }} onClick={onClick}>
29
<Icon name="times" />
30
</a>
31
);
32
};
33
34