tor-browser

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

FieldPair.js (1264B)


      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  PureComponent,
      9 } = require("resource://devtools/client/shared/vendor/react.mjs");
     10 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
     11 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
     12 
     13 /* Renders a pair of `<dt>` (label) + `<dd>` (value) field. */
     14 class FieldPair extends PureComponent {
     15  static get propTypes() {
     16    return {
     17      className: PropTypes.string,
     18      label: PropTypes.node.isRequired,
     19      value: PropTypes.node,
     20    };
     21  }
     22 
     23  render() {
     24    const { label, value } = this.props;
     25    return dom.div(
     26      {
     27        className: "fieldpair",
     28      },
     29      dom.dt(
     30        {
     31          className:
     32            "fieldpair__title " +
     33            (this.props.className ? this.props.className : ""),
     34        },
     35        label
     36      ),
     37      value
     38        ? dom.dd(
     39            {
     40              className: "fieldpair__description ellipsis-text",
     41            },
     42            value
     43          )
     44        : null
     45    );
     46  }
     47 }
     48 
     49 module.exports = FieldPair;