var _excluded = ["sortable", "sorting"];
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from "react";
import styled from "styled-components";
import Flex from "../../../templates/flex";
import { Icon } from "../../../icon";
var sortingIcons = {
  asc: "sort_ascending",
  desc: "sort_descending",
  indicator: "sort_indicator"
};

// Needed to be targeted by parent on hover
export var SortIconContainer = styled(Flex).attrs(function (props) {
  return _extends({
    flex: 0
  }, props);
}).withConfig({
  displayName: "sorting__SortIconContainer",
  componentId: "sc-41slpt-0"
})(["transition:opacity 200ms ease;opacity:", ";"], function (_ref) {
  var sorting = _ref.sorting;
  return sorting ? 1 : 0;
});
var Sorting = function Sorting(_ref2) {
  var sortable = _ref2.sortable,
    sorting = _ref2.sorting,
    rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
  if (!sortable) return null;
  return /*#__PURE__*/React.createElement(SortIconContainer, {
    sorting: sorting
  }, /*#__PURE__*/React.createElement(Icon, _extends({
    height: "12px",
    width: "12px",
    color: sorting ? "text" : "textLite",
    name: sortingIcons[sorting] || sortingIcons.indicator
  }, rest)));
};
export default Sorting;