UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

62 lines (61 loc) 8.72 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral")); var _react = _interopRequireDefault(require("react")); var _styledComponents = _interopRequireDefault(require("styled-components")); var _icons = require("./icons"); var _utils = require("@kepler.gl/utils"); var _templateObject; // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project var TimeValueWrapper = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n font-size: ", ";\n justify-content: ", ";\n\n .horizontal-bar {\n padding: 0 12px;\n color: ", ";\n }\n\n .time-value {\n display: flex;\n flex-direction: ", ";\n align-items: flex-start;\n max-width: ", ";\n span {\n color: ", ";\n }\n }\n\n .time-value:last-child {\n align-items: flex-end;\n text-align: right;\n }\n"])), function (props) { return props.theme.timeTitleFontSize; }, function (props) { return props.isEnlarged ? 'center' : 'space-between'; }, function (props) { return props.theme.textColor; }, function (props) { return props.isEnlarged ? 'row' : 'column'; }, function (props) { return !props.isEnlarged ? '40%' : 'auto'; }, function (props) { return props.theme.textColor; }); var TimeValue = function TimeValue(_ref) { var value = _ref.value; return ( /*#__PURE__*/ // render two lines if not enlarged _react["default"].createElement("div", { className: "time-value" }, /*#__PURE__*/_react["default"].createElement("span", null, value)) ); }; function TimeRangeSliderTimeTitleFactory() { var TimeTitle = function TimeTitle(_ref2) { var value = _ref2.value, isEnlarged = _ref2.isEnlarged, timezone = _ref2.timezone, timeFormat = _ref2.timeFormat; return /*#__PURE__*/_react["default"].createElement(TimeValueWrapper, { isEnlarged: isEnlarged, className: "time-range-slider__time-title" }, /*#__PURE__*/_react["default"].createElement(TimeValue, { key: 0, value: (0, _utils.datetimeFormatter)(timezone)(timeFormat)(value[0]) }), isEnlarged ? /*#__PURE__*/_react["default"].createElement("div", { className: "horizontal-bar" }, /*#__PURE__*/_react["default"].createElement(_icons.Minus, { height: "12px" })) : null, /*#__PURE__*/_react["default"].createElement(TimeValue, { key: 1, value: (0, _utils.datetimeFormatter)(timezone)(timeFormat)(value[1]) })); }; return TimeTitle; } var _default = exports["default"] = TimeRangeSliderTimeTitleFactory; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwicmVxdWlyZSIsIl9zdHlsZWRDb21wb25lbnRzIiwiX2ljb25zIiwiX3V0aWxzIiwiX3RlbXBsYXRlT2JqZWN0IiwiVGltZVZhbHVlV3JhcHBlciIsInN0eWxlZCIsImRpdiIsIl90YWdnZWRUZW1wbGF0ZUxpdGVyYWwyIiwicHJvcHMiLCJ0aGVtZSIsInRpbWVUaXRsZUZvbnRTaXplIiwiaXNFbmxhcmdlZCIsInRleHRDb2xvciIsIlRpbWVWYWx1ZSIsIl9yZWYiLCJ2YWx1ZSIsImNyZWF0ZUVsZW1lbnQiLCJjbGFzc05hbWUiLCJUaW1lUmFuZ2VTbGlkZXJUaW1lVGl0bGVGYWN0b3J5IiwiVGltZVRpdGxlIiwiX3JlZjIiLCJ0aW1lem9uZSIsInRpbWVGb3JtYXQiLCJrZXkiLCJkYXRldGltZUZvcm1hdHRlciIsIk1pbnVzIiwiaGVpZ2h0IiwiX2RlZmF1bHQiLCJleHBvcnRzIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbW1vbi90aW1lLXJhbmdlLXNsaWRlci10aW1lLXRpdGxlLnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBTUERYLUxpY2Vuc2UtSWRlbnRpZmllcjogTUlUXG4vLyBDb3B5cmlnaHQgY29udHJpYnV0b3JzIHRvIHRoZSBrZXBsZXIuZ2wgcHJvamVjdFxuXG5pbXBvc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