tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

UIButton.js (1100B)


      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 "use strict";
      6 
      7 const {
      8  PureComponent,
      9 } = require("resource://devtools/client/shared/vendor/react.mjs");
     10 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
     11 const {
     12  button,
     13 } = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     14 
     15 class UIButton extends PureComponent {
     16  static get propTypes() {
     17    return {
     18      children: PropTypes.node,
     19      className: PropTypes.string,
     20      disabled: PropTypes.bool,
     21      onClick: PropTypes.func,
     22      size: PropTypes.oneOf(["micro"]),
     23    };
     24  }
     25 
     26  render() {
     27    const { className, disabled, onClick, size } = this.props;
     28    const sizeClass = size ? `ui-button--${size}` : "";
     29 
     30    return button(
     31      {
     32        className: `ui-button ${className || ""} ${sizeClass}`,
     33        onClick,
     34        disabled,
     35      },
     36      this.props.children
     37    );
     38  }
     39 }
     40 
     41 module.exports = UIButton;