@lonli-lokli/react-mosaic-component
Version:
A React Tiling Window Manager
37 lines (36 loc) • 1 kB
JavaScript
// libs/react-mosaic-component/src/lib/buttons/TabRemoveButton.tsx
import classNames from "classnames";
import React from "react";
import { MosaicContext } from "../contextTypes.mjs";
import { OptionalBlueprint } from "../util/OptionalBlueprint.mjs";
import { DefaultToolbarButton } from "./MosaicButton.mjs";
var TabRemoveButton = class extends React.PureComponent {
static contextType = MosaicContext;
render() {
return /* @__PURE__ */ React.createElement(
DefaultToolbarButton,
{
title: "Close Tab Group",
className: classNames(
"close-button",
OptionalBlueprint.getIconClass(
this.context.blueprintNamespace,
"CROSS"
)
),
onClick: this.remove
}
);
}
remove = () => {
const { mosaicActions } = this.context;
const { path } = this.props;
mosaicActions.remove(path);
if (this.props.onClick) {
this.props.onClick();
}
};
};
export {
TabRemoveButton
};