tor-browser

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

Badge.js (1036B)


      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 "use strict";
      5 
      6 // React
      7 const {
      8  Component,
      9 } = require("resource://devtools/client/shared/vendor/react.mjs");
     10 const {
     11  span,
     12 } = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     13 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
     14 
     15 class Badge extends Component {
     16  static get propTypes() {
     17    return {
     18      score: PropTypes.string.isRequired,
     19      label: PropTypes.string.isRequired,
     20      ariaLabel: PropTypes.string,
     21      tooltip: PropTypes.string,
     22    };
     23  }
     24 
     25  render() {
     26    const { score, label, ariaLabel, tooltip } = this.props;
     27 
     28    return span(
     29      {
     30        className: `audit-badge badge`,
     31        "data-score": score,
     32        title: tooltip,
     33        "aria-label": ariaLabel || label,
     34      },
     35      label
     36    );
     37  }
     38 }
     39 
     40 module.exports = Badge;