Header.js
2.44 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
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _PanelContext = _interopRequireDefault(require("../PanelContext"));
var HIDDEN_STYLE = {
visibility: 'hidden'
};
function Header(_ref) {
var prefixCls = _ref.prefixCls,
_ref$prevIcon = _ref.prevIcon,
prevIcon = _ref$prevIcon === void 0 ? "\u2039" : _ref$prevIcon,
_ref$nextIcon = _ref.nextIcon,
nextIcon = _ref$nextIcon === void 0 ? "\u203A" : _ref$nextIcon,
_ref$superPrevIcon = _ref.superPrevIcon,
superPrevIcon = _ref$superPrevIcon === void 0 ? "\xAB" : _ref$superPrevIcon,
_ref$superNextIcon = _ref.superNextIcon,
superNextIcon = _ref$superNextIcon === void 0 ? "\xBB" : _ref$superNextIcon,
onSuperPrev = _ref.onSuperPrev,
onSuperNext = _ref.onSuperNext,
onPrev = _ref.onPrev,
onNext = _ref.onNext,
children = _ref.children;
var _React$useContext = React.useContext(_PanelContext.default),
hideNextBtn = _React$useContext.hideNextBtn,
hidePrevBtn = _React$useContext.hidePrevBtn;
return /*#__PURE__*/React.createElement("div", {
className: prefixCls
}, onSuperPrev && /*#__PURE__*/React.createElement("button", {
type: "button",
onClick: onSuperPrev,
tabIndex: -1,
className: "".concat(prefixCls, "-super-prev-btn"),
style: hidePrevBtn ? HIDDEN_STYLE : {}
}, superPrevIcon), onPrev && /*#__PURE__*/React.createElement("button", {
type: "button",
onClick: onPrev,
tabIndex: -1,
className: "".concat(prefixCls, "-prev-btn"),
style: hidePrevBtn ? HIDDEN_STYLE : {}
}, prevIcon), /*#__PURE__*/React.createElement("div", {
className: "".concat(prefixCls, "-view")
}, children), onNext && /*#__PURE__*/React.createElement("button", {
type: "button",
onClick: onNext,
tabIndex: -1,
className: "".concat(prefixCls, "-next-btn"),
style: hideNextBtn ? HIDDEN_STYLE : {}
}, nextIcon), onSuperNext && /*#__PURE__*/React.createElement("button", {
type: "button",
onClick: onSuperNext,
tabIndex: -1,
className: "".concat(prefixCls, "-super-next-btn"),
style: hideNextBtn ? HIDDEN_STYLE : {}
}, superNextIcon));
}
var _default = Header;
exports.default = _default;