tor-browser

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

NodePane.js (1607B)


      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  createFactory,
      9  PureComponent,
     10 } = require("resource://devtools/client/shared/vendor/react.mjs");
     11 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     12 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
     13 
     14 const FluentReact = require("resource://devtools/client/shared/vendor/fluent-react.js");
     15 const Localized = createFactory(FluentReact.Localized);
     16 
     17 const Types = require("resource://devtools/client/inspector/compatibility/types.js");
     18 
     19 const NodeList = createFactory(
     20  require("resource://devtools/client/inspector/compatibility/components/NodeList.js")
     21 );
     22 
     23 class NodePane extends PureComponent {
     24  static get propTypes() {
     25    return {
     26      dispatch: PropTypes.func.isRequired,
     27      nodes: PropTypes.arrayOf(Types.node).isRequired,
     28      setSelectedNode: PropTypes.func.isRequired,
     29    };
     30  }
     31 
     32  render() {
     33    const { nodes } = this.props;
     34 
     35    return dom.details(
     36      {
     37        className: "compatibility-node-pane",
     38        open: nodes.length <= 1,
     39      },
     40      Localized(
     41        {
     42          id: "compatibility-issue-occurrences",
     43          $number: nodes.length,
     44        },
     45        dom.summary(
     46          { className: "compatibility-node-pane__summary" },
     47          "compatibility-issue-occurrences"
     48        )
     49      ),
     50      NodeList(this.props)
     51    );
     52  }
     53 }
     54 
     55 module.exports = NodePane;