tor-browser

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

ManifestSection.js (1139B)


      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 PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
      8 const {
      9  PureComponent,
     10 } = require("resource://devtools/client/shared/vendor/react.mjs");
     11 const {
     12  h2,
     13  section,
     14 } = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     15 
     16 /**
     17 * A section of a manifest in the form of a captioned table.
     18 */
     19 class ManifestSection extends PureComponent {
     20  static get propTypes() {
     21    return {
     22      children: PropTypes.node,
     23      title: PropTypes.string.isRequired,
     24    };
     25  }
     26 
     27  render() {
     28    const { children, title } = this.props;
     29    const isEmpty = !children || children.length === 0;
     30 
     31    return section(
     32      {
     33        className: `manifest-section ${
     34          isEmpty ? "manifest-section--empty" : ""
     35        }`,
     36      },
     37      h2({ className: "manifest-section__title" }, title),
     38      children
     39    );
     40  }
     41 }
     42 
     43 // Exports
     44 module.exports = ManifestSection;