CloseButton.js (915B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 import React from "devtools/client/shared/vendor/react"; 6 import { button } from "devtools/client/shared/vendor/react-dom-factories"; 7 import PropTypes from "devtools/client/shared/vendor/react-prop-types"; 8 9 import DebuggerImage from "../DebuggerImage"; 10 11 function CloseButton({ handleClick, buttonClass, tooltip }) { 12 return button( 13 { 14 className: buttonClass ? `close-btn ${buttonClass}` : "close-btn", 15 onClick: handleClick, 16 title: tooltip, 17 }, 18 React.createElement(DebuggerImage, { 19 name: "close", 20 }) 21 ); 22 } 23 24 CloseButton.propTypes = { 25 buttonClass: PropTypes.string, 26 handleClick: PropTypes.func.isRequired, 27 tooltip: PropTypes.string, 28 }; 29 30 export default CloseButton;