"use strict";

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

var _preact = require("preact");

var _icon = require("./icon");

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

/**
 * @typedef PillsProps
 * @property {{ icon: string; text: string }[]} items
 * @property {string} [pillBgColor]
 * @property {string} [pillTextColor]
 */

/**
 * Pills
 *
 * @typedef {import('preact').FunctionComponent} CardComponent
 * @param {PillsProps} Props
 */
var _default = (_ref) => {
  let {
    items,
    pillBgColor = 'white',
    pillTextColor = 'dark-blue'
  } = _ref,
      rest = _objectWithoutProperties(_ref, ["items", "pillBgColor", "pillTextColor"]);

  return (0, _preact.h)("div", rest, items.map(({
    icon,
    text
  }, index) => (0, _preact.h)("span", {
    key: text,
    className: "inline-flex items-center pa1 f6 bg-".concat(pillBgColor, " ").concat(pillTextColor, " br-pill mr").concat(index === items.length - 1 ? '0' : '2')
  }, (0, _preact.h)(_icon.Icon, {
    icon: icon,
    size: "16",
    className: "mr2 ml1"
  }), (0, _preact.h)("span", {
    className: "mr1"
  }, text))));
};

exports.default = _default;