"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TimeRangeItem = void 0;

var _react = _interopRequireWildcard(require("react"));

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _components = require("./components.css-rules");

var _unstyledButton = require("../../../core/behaviors/unstyled-button/unstyled-button.component");

var _span = require("../../../core/typography/span");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var TimeRangeItemButton = (0, _styledComponents["default"])(_unstyledButton.UnstyledButton).withConfig({
  displayName: "TimeRangeItemButton",
  componentId: "sc-16x4qng-0"
})(["background:", ";border-radius:20px;color:", ";padding:10px;position:relative;transition:0.15s cubic-bezier(0.34,0,0.53,1.3);z-index:1;"], _components.getBackground, _components.getForeground);

var TimeRangeItem = function TimeRangeItem(_ref) {
  var value = _ref.value,
      selected = _ref.selected,
      onClick = _ref.onClick,
      label = _ref.label,
      fontSize = _ref.fontSize;
  var handleOnClick = (0, _react.useCallback)(function () {
    onClick(value);
  }, [value, onClick]);
  return /*#__PURE__*/_react["default"].createElement(TimeRangeItemButton, {
    onClick: handleOnClick,
    selected: selected
  }, /*#__PURE__*/_react["default"].createElement(_span.Span, {
    bold: true,
    fontSize: fontSize
  }, label));
};

exports.TimeRangeItem = TimeRangeItem;