1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = undefined;
|
7 |
|
8 | var _react = require("react");
|
9 |
|
10 | var _createReactClass = require("create-react-class");
|
11 |
|
12 | var _createReactClass2 = _interopRequireDefault(_createReactClass);
|
13 |
|
14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15 |
|
16 | var Tip = (0, _createReactClass2.default)({
|
17 | displayName: "tip",
|
18 | render: function render() {
|
19 | var direction = this.props.direction;
|
20 |
|
21 | var size = this.props.size || 24;
|
22 | var isPortrait = direction === "up" || direction === "down";
|
23 | var mainLength = size;
|
24 | var crossLength = size * 2;
|
25 | var points = direction === "up" ? "0," + mainLength + " " + mainLength + ",0, " + crossLength + "," + mainLength : direction === "down" ? "0,0 " + mainLength + "," + mainLength + ", " + crossLength + ",0" : direction === "left" ? mainLength + ",0 0," + mainLength + ", " + mainLength + "," + crossLength : "0,0 " + mainLength + "," + mainLength + ", 0," + crossLength;
|
26 | var props = {
|
27 | className: "Popover-tip",
|
28 | width: isPortrait ? crossLength : mainLength,
|
29 | height: isPortrait ? mainLength : crossLength
|
30 | };
|
31 | var triangle = _react.DOM.svg(props, _react.DOM.polygon({
|
32 | className: "Popover-tipShape",
|
33 | points: points
|
34 | }));
|
35 | return triangle;
|
36 | }
|
37 | });
|
38 |
|
39 | exports.default = Tip; |
\ | No newline at end of file |