UNPKG

1.76 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';
6import React, { Component } from 'react';
7import PropTypes from 'prop-types';
8import Text from './text';
9import ConfigProvider from '../config-provider';
10
11export default (function (Tag) {
12 var _class, _temp;
13
14 /**
15 * Typography.Title
16 * @description 分为 H1, H2, H3, H4, H5, H6 不同的组件,表示不同层级,继承 Typography.Text API
17 * @order 1
18 */
19 var Title = (_temp = _class = function (_Component) {
20 _inherits(Title, _Component);
21
22 function Title() {
23 _classCallCheck(this, Title);
24
25 return _possibleConstructorReturn(this, _Component.apply(this, arguments));
26 }
27
28 Title.prototype.render = function render() {
29 var _props = this.props,
30 prefix = _props.prefix,
31 className = _props.className,
32 others = _objectWithoutProperties(_props, ['prefix', 'className']);
33
34 return React.createElement(Text, _extends({}, others, {
35 component: Tag,
36 className: (className || '') + ' ' + prefix + 'typography-title'
37 }));
38 };
39
40 return Title;
41 }(Component), _class.propTypes = {
42 prefix: PropTypes.string
43 }, _class.defaultProps = {
44 prefix: 'next-'
45 }, _temp);
46 Title.displayName = 'Title';
47
48
49 Title.displayName = Tag.toUpperCase();
50 return ConfigProvider.config(Title);
51});
\No newline at end of file