1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
3 | import _createClass from 'babel-runtime/helpers/createClass';
|
4 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
5 | import _inherits from 'babel-runtime/helpers/inherits';
|
6 | var __rest = this && this.__rest || function (s, e) {
|
7 | var t = {};
|
8 | for (var p in s) {
|
9 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
10 | }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
11 | if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
|
12 | }return t;
|
13 | };
|
14 | import classnames from 'classnames';
|
15 | import React from 'react';
|
16 |
|
17 | var NavBar = function (_React$Component) {
|
18 | _inherits(NavBar, _React$Component);
|
19 |
|
20 | function NavBar() {
|
21 | _classCallCheck(this, NavBar);
|
22 |
|
23 | return _possibleConstructorReturn(this, (NavBar.__proto__ || Object.getPrototypeOf(NavBar)).apply(this, arguments));
|
24 | }
|
25 |
|
26 | _createClass(NavBar, [{
|
27 | key: 'render',
|
28 | value: function render() {
|
29 | var _a = this.props,
|
30 | prefixCls = _a.prefixCls,
|
31 | className = _a.className,
|
32 | children = _a.children,
|
33 | mode = _a.mode,
|
34 | icon = _a.icon,
|
35 | onLeftClick = _a.onLeftClick,
|
36 | leftContent = _a.leftContent,
|
37 | rightContent = _a.rightContent,
|
38 | restProps = __rest(_a, ["prefixCls", "className", "children", "mode", "icon", "onLeftClick", "leftContent", "rightContent"]);
|
39 | return React.createElement(
|
40 | 'div',
|
41 | _extends({}, restProps, { className: classnames(className, prefixCls, prefixCls + '-' + mode) }),
|
42 | React.createElement(
|
43 | 'div',
|
44 | { className: prefixCls + '-left', role: 'button', onClick: onLeftClick },
|
45 | icon ?
|
46 |
|
47 | React.createElement(
|
48 | 'span',
|
49 | { className: prefixCls + '-left-icon', 'aria-hidden': 'true' },
|
50 | icon
|
51 | ) : null,
|
52 | leftContent
|
53 | ),
|
54 | React.createElement(
|
55 | 'div',
|
56 | { className: prefixCls + '-title' },
|
57 | children
|
58 | ),
|
59 | React.createElement(
|
60 | 'div',
|
61 | { className: prefixCls + '-right' },
|
62 | rightContent
|
63 | )
|
64 | );
|
65 | }
|
66 | }]);
|
67 |
|
68 | return NavBar;
|
69 | }(React.Component);
|
70 |
|
71 | export default NavBar;
|
72 |
|
73 | NavBar.defaultProps = {
|
74 | prefixCls: 'am-navbar',
|
75 | mode: 'dark',
|
76 | onLeftClick: function onLeftClick() {}
|
77 | }; |
\ | No newline at end of file |