UNPKG

2.48 kBJavaScriptView Raw
1import _extends from 'babel-runtime/helpers/extends';
2import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
3import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
4import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
5import _inherits from 'babel-runtime/helpers/inherits';
6
7var _class, _temp;
8
9import React from 'react';
10import PropTypes from 'prop-types';
11import classNames from 'classnames';
12import ConfigProvider from '../config-provider';
13import { log } from '../util';
14
15/* eslint-disable */
16
17/** Paragraph */
18var Paragraph = (_temp = _class = function (_React$Component) {
19 _inherits(Paragraph, _React$Component);
20
21 function Paragraph(props) {
22 _classCallCheck(this, Paragraph);
23
24 var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
25
26 log.warning('[Paragraph] is deprecated, please use Typography.Paragraph instead!');
27 return _this;
28 }
29
30 Paragraph.prototype.render = function render() {
31 var _props = this.props,
32 prefix = _props.prefix,
33 className = _props.className,
34 type = _props.type,
35 size = _props.size,
36 rtl = _props.rtl,
37 others = _objectWithoutProperties(_props, ['prefix', 'className', 'type', 'size', 'rtl']);
38
39 var cls = classNames(prefix + 'paragraph', type === 'short' ? prefix + 'paragraph-short' : prefix + 'paragraph-long', size === 'small' ? prefix + 'paragraph-small' : prefix + 'paragraph-medium', className);
40 if (rtl) {
41 others.dir = 'rtl';
42 }
43
44 return React.createElement(
45 'div',
46 _extends({}, others, { className: cls }),
47 this.props.children
48 );
49 };
50
51 return Paragraph;
52}(React.Component), _class.propTypes = {
53 prefix: PropTypes.string,
54 /**
55 * 额外的样式名 会附加到 root dom 上
56 */
57 className: PropTypes.string,
58 /**
59 * 什么方式展示段落
60 * @enumdesc 展示所有文本, 展示三行以内(非强制)
61 */
62 type: PropTypes.oneOf(['long', 'short']),
63 /**
64 * 组件大小。
65 * @enumdesc 中号, 小号
66 */
67 size: PropTypes.oneOf(['medium', 'small']),
68 rtl: PropTypes.bool
69}, _class.defaultProps = {
70 prefix: 'next-',
71 type: 'long',
72 size: 'medium'
73}, _temp);
74Paragraph.displayName = 'Paragraph';
75
76
77export default ConfigProvider.config(Paragraph);
\No newline at end of file