UNPKG

1.21 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _react = require("react");
8
9var _react2 = _interopRequireDefault(_react);
10
11function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13var Tip = function Tip(props) {
14 var direction = props.direction;
15
16 var size = props.size || 24;
17 var isPortrait = direction === "up" || direction === "down";
18 var mainLength = size;
19 var crossLength = size * 2;
20 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;
21 var svgProps = {
22 className: "Popover-tip",
23 width: isPortrait ? crossLength : mainLength,
24 height: isPortrait ? mainLength : crossLength
25 };
26
27 return _react2.default.createElement(
28 "svg",
29 svgProps,
30 _react2.default.createElement("polygon", {
31 className: "Popover-tipShape",
32 points: points
33 })
34 );
35};
36
37exports.default = Tip;
\No newline at end of file