Path: blob/master/src/packages/frontend/components/close-x2.tsx
1503 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import React from "react";6import { CSS } from "@cocalc/frontend/app-framework";7import { Icon } from "./icon";89interface Props {10style?: React.CSSProperties;11close?: () => void;12}1314const DEFAULT_STYLE: CSS = {15cursor: "pointer",16fontSize: "13pt",17};1819function isSame(prev, next) {20if (prev == null || next == null) {21return false;22}23return prev.close != next.close;24}2526export const CloseX2: React.FC<Props> = React.memo((props: Props) => {27const { close = undefined, style = DEFAULT_STYLE } = props;2829if (!close) {30return null;31} else {32return (33<div className={"pull-right lighten"} style={style} onClick={close}>34<Icon name={"times"} />35</div>36);37}38}, isSame);394041