tor-browser

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

Toolbar.mjs (1161B)


      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 { Component } from "resource://devtools/client/shared/vendor/react.mjs";
      6 import PropTypes from "resource://devtools/client/shared/vendor/react-prop-types.mjs";
      7 import * as dom from "resource://devtools/client/shared/vendor/react-dom-factories.mjs";
      8 
      9 /**
     10 * Renders a simple toolbar.
     11 */
     12 class Toolbar extends Component {
     13  static get propTypes() {
     14    return {
     15      children: PropTypes.oneOfType([PropTypes.array, PropTypes.element]),
     16    };
     17  }
     18 
     19  render() {
     20    return dom.div({ className: "toolbar" }, this.props.children);
     21  }
     22 }
     23 
     24 /**
     25 * Renders a simple toolbar button.
     26 */
     27 class ToolbarButton extends Component {
     28  static get propTypes() {
     29    return {
     30      active: PropTypes.bool,
     31      disabled: PropTypes.bool,
     32      children: PropTypes.string,
     33    };
     34  }
     35 
     36  render() {
     37    const props = Object.assign({ className: "btn" }, this.props);
     38    return dom.button(props, this.props.children);
     39  }
     40 }
     41 
     42 export default { Toolbar, ToolbarButton };