UNPKG

1.38 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = undefined;
7
8var _react = require("react");
9
10var _createReactClass = require("create-react-class");
11
12var _createReactClass2 = _interopRequireDefault(_createReactClass);
13
14function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
16var 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
39exports.default = Tip;
\No newline at end of file