/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import styles from "./close-button.module.scss"; import type { HTMLAttributes } from "react"; import React from "react"; import { Icon } from "../icon"; import { withInjectables } from "@ogre-tools/injectable-react"; import captureWithIdInjectable from "../../telemetry/capture-with-id.injectable"; export interface CloseButtonProps extends HTMLAttributes { } interface Dependencies { capture: (id: string, action: string) => void; } function NonInjectedCloseButton(props: CloseButtonProps & Dependencies) { const { capture, ...rest } = props; return (
{ capture(`${window.location.pathname}`, "Close Button Click"); props?.onClick?.(e); }}>
); } export const CloseButton = withInjectables( NonInjectedCloseButton, { getProps: (di, props) => ({ capture: di.inject(captureWithIdInjectable), ...props, }), }, );