@guardian/threads
Version:
24 lines • 1.16 kB
JavaScript
import { __extends } from "tslib";
import React, { Component } from 'react';
import { MdHelpOutline } from 'react-icons/md';
import styles from './ControlWrap.module.css';
var ControlWrap = /** @class */ (function (_super) {
__extends(ControlWrap, _super);
function ControlWrap() {
return _super !== null && _super.apply(this, arguments) || this;
}
ControlWrap.prototype.render = function () {
var _a = this.props, title = _a.title, htmlFor = _a.htmlFor, children = _a.children, help = _a.help, vertical = _a.vertical, Wrapper = _a.wrapper;
return (React.createElement(Wrapper.type, { className: vertical ? styles.verticalWrap : styles.wrap, title: help, htmlFor: htmlFor },
(title || help) && (React.createElement("header", { "data-has-help": help !== null, className: styles.title },
title,
help && React.createElement(MdHelpOutline, null))),
children));
};
ControlWrap.defaultProps = {
wrapper: React.createElement("label", null),
};
return ControlWrap;
}(Component));
export { ControlWrap };
//# sourceMappingURL=ControlWrap.js.map