13879f441bb0410a38d52704637e2a3cd01113c7.svn-base
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _chalk = _interopRequireDefault(require("chalk"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable camelcase */
const Text = ({
bold,
italic,
underline,
strikethrough,
children,
unstable__transformChildren
}) => {
const transformChildren = children => {
if (bold) {
children = _chalk.default.bold(children);
}
if (italic) {
children = _chalk.default.italic(children);
}
if (underline) {
children = _chalk.default.underline(children);
}
if (strikethrough) {
children = _chalk.default.strikethrough(children);
}
if (unstable__transformChildren) {
children = unstable__transformChildren(children);
}
return children;
};
return _react.default.createElement("span", {
style: {
flexDirection: 'row'
},
unstable__transformChildren: transformChildren
}, children);
};
/* eslint-disable react/boolean-prop-naming */
Text.propTypes = {
bold: _propTypes.default.bool,
italic: _propTypes.default.bool,
underline: _propTypes.default.bool,
strikethrough: _propTypes.default.bool,
children: _propTypes.default.node.isRequired,
unstable__transformChildren: _propTypes.default.func
};
/* eslint-enable react/boolean-prop-naming */
Text.defaultProps = {
bold: false,
italic: false,
underline: false,
strikethrough: false,
unstable__transformChildren: undefined
};
var _default = Text;
exports.default = _default;