import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { useState } from 'react';
import { Dropdown } from 'react-bootstrap';
import { DropdownStationSelect } from './style.js';
import DropdownArrowIcon from '../../Icons/DropdownArrowIcon/index.js';
import theme from '../../../Globals/theme.js';
import { ThemeProvider } from 'styled-components';
import globalStyle from '../../../Globals/global-styles.js';

var StationDropdown = function StationDropdown(_ref) {
  var dropdownOptions = _ref.dropdownOptions,
      placeholder = _ref.placeholder;

  var _useState = useState(null),
      _useState2 = _slicedToArray(_useState, 2),
      option = _useState2[0],
      setOption = _useState2[1];

  var onChange = function onChange(key) {
    setOption(dropdownOptions[key]);
  };

  return /*#__PURE__*/React__default.createElement(ThemeProvider, {
    theme: theme
  }, /*#__PURE__*/React__default.createElement(globalStyle, null), /*#__PURE__*/React__default.createElement(DropdownStationSelect, null, /*#__PURE__*/React__default.createElement(Dropdown, {
    onSelect: onChange,
    id: "DropdownStationSelect"
  }, /*#__PURE__*/React__default.createElement(Dropdown.Toggle, null, option ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, option.icon, /*#__PURE__*/React__default.createElement("span", null, option.title)) : placeholder, /*#__PURE__*/React__default.createElement(DropdownArrowIcon, null)), /*#__PURE__*/React__default.createElement(Dropdown.Menu, null, dropdownOptions.map(function (e, idx) {
    return /*#__PURE__*/React__default.createElement(Dropdown.Item, {
      eventKey: idx,
      href: e.href
    }, e.icon, e.title);
  })))));
};

export { StationDropdown as default };
//# sourceMappingURL=index.js.map
