'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _react3 = require('@storybook/react');

var _addonKnobs = require('@storybook/addon-knobs');

var _Paragraph = require('../../atoms/text/Paragraph');

var _Paragraph2 = _interopRequireDefault(_Paragraph);

var _index = require('./index');

var _index2 = _interopRequireDefault(_index);

var _AccordionItem = require('./AccordionItem.md');

var _AccordionItem2 = _interopRequireDefault(_AccordionItem);

var _Icon = require('../../base/Icon');

var _Icon2 = _interopRequireDefault(_Icon);

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

var getIcon = function getIcon(iconProps) {
  return _react2.default.createElement(_Icon2.default, iconProps);
};

var icons = {
  circlechevron: getIcon({ name: 'circlechevron' }),
  laptop: getIcon({ name: 'laptop' }),
  phone: getIcon({ name: 'phone' }),
  fax: getIcon({ name: 'fax' }),
  none: null
};

(0, _react3.storiesOf)('molecules', module).addDecorator((0, _addonKnobs.withKnobs)({ escapeHTML: false })).add('AccordionItem', function () {
  var props = {
    title: (0, _addonKnobs.text)('title', 'Collapsible Header'),
    info: (0, _addonKnobs.text)('info', 'Collapsible Header'),
    icon: (0, _addonKnobs.select)('icon', Object.keys(icons), 'circlechevron'),
    border: (0, _addonKnobs.boolean)('border', true),
    emphasize: (0, _addonKnobs.boolean)('emphasize', true),
    secondary: (0, _addonKnobs.boolean)('secondary', false),
    headerLevel: (0, _addonKnobs.select)('headerLevel', [1, 2, 3, 4, 5, 6], 2),
    id: (0, _addonKnobs.text)('id', 'accordionid')
  };

  // Example of child element, paragraph, passable to accordion
  var child = {
    paragraph: (0, _addonKnobs.text)('children.paragraph.text (example)', 'Most parks and beaches that charge daily parking fees sell MassParks Passes at their contact stations during their paid parking seasons. Just ask to purchase a MassParks Pass and show your driver’s license or proof of residency. Please note: most parks cannot accept credit cards, so you’ll have to pay with cash or a check')
  };

  // Set the icon prop to the actual element based on knob selection.
  props.icon = icons[props.icon];

  return _react2.default.createElement(
    _index2.default,
    props,
    _react2.default.createElement(_Paragraph2.default, { text: child.paragraph })
  );
}, { info: _AccordionItem2.default });