tor-browser

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

Description.js (1566B)


      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 // @ts-check
      5 
      6 /**
      7 * @typedef {{}} Props - This is an empty object.
      8 */
      9 
     10 "use strict";
     11 
     12 const {
     13  PureComponent,
     14  createFactory,
     15 } = require("resource://devtools/client/shared/vendor/react.mjs");
     16 const {
     17  div,
     18  button,
     19  p,
     20 } = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     21 const Localized = createFactory(
     22  require("resource://devtools/client/shared/vendor/fluent-react.js").Localized
     23 );
     24 
     25 /**
     26 * This component provides a helpful description for what is going on in the component
     27 * and provides some external links.
     28 *
     29 * @augments {React.PureComponent<Props>}
     30 */
     31 class Description extends PureComponent {
     32  /**
     33   * @param {React.MouseEvent<HTMLButtonElement>} event
     34   */
     35  handleLinkClick = event => {
     36    const {
     37      openDocLink,
     38    } = require("resource://devtools/client/shared/link.js");
     39 
     40    /** @type HTMLButtonElement */
     41    const target = /** @type {any} */ (event.target);
     42 
     43    openDocLink(target.value, {});
     44  };
     45 
     46  render() {
     47    return div(
     48      { className: "perf-description" },
     49      Localized(
     50        {
     51          id: "perftools-description-intro",
     52          a: button({
     53            className: "perf-external-link",
     54            onClick: this.handleLinkClick,
     55            value: "https://profiler.firefox.com",
     56          }),
     57        },
     58        p({})
     59      )
     60    );
     61  }
     62 }
     63 
     64 module.exports = Description;