"use strict";

var _react = _interopRequireDefault(require("react"));
var _react2 = require("@storybook/react");
var _index = _interopRequireDefault(require("./index"));
var _storybookState = require("@sambego/storybook-state");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var mockedFontsList = [{
  identifier: 'Calibri',
  title: 'Calibri',
  value: 'Calibri'
}, {
  identifier: 'Arial',
  title: 'Arial',
  value: 'Arial'
}, {
  identifier: 'Helvetica',
  title: 'Helvetica',
  value: 'Helvetica'
}, {
  identifier: 'Times New Roman',
  title: 'Times New Roman',
  value: 'Times New Roman'
}, {
  identifier: 'Roboto',
  title: 'Roboto',
  value: 'Roboto'
}, {
  identifier: 'Verdana',
  title: 'Verdana',
  value: 'Verdana'
}];
var store = new _storybookState.Store({
  textValue: 'Lorem ipsum dolor sit amet, cosectetur adipiscing elit',
  fontValue: 'Calibri',
  fontSizeValue: 10
});
function incrementFontSize(max) {
  if (store.state.fontSizeValue < max) {
    store.set({
      fontSizeValue: store.state.fontSizeValue + 1
    });
  }
}
function decrementFontSize(min) {
  if (store.state.fontSizeValue > min) {
    store.set({
      fontSizeValue: store.state.fontSizeValue - 1
    });
  }
}
function handleChangeFont(event) {
  store.set({
    fontValue: event.target.value
  });
}
function handleChangeText(event) {
  store.set({
    textValue: event.target.value
  });
}
(0, _react2.storiesOf)('TextControlbox', module).add('boxed component', function () {
  return /*#__PURE__*/_react["default"].createElement(_storybookState.State, {
    store: store
  }, function (state) {
    return [/*#__PURE__*/_react["default"].createElement(_index["default"], {
      boxed: true,
      textValue: state.textValue,
      handleChangeText: handleChangeText,
      fontValue: state.fontValue,
      fonts: mockedFontsList,
      handleChangeFont: handleChangeFont,
      minSize: 8,
      maxSize: 12,
      fontSizeValue: state.fontSizeValue,
      key: state.textValue,
      incrementFontSize: incrementFontSize,
      decrementFontSize: decrementFontSize
    })];
  });
}).add('unboxed component', function () {
  return /*#__PURE__*/_react["default"].createElement(_storybookState.State, {
    store: store
  }, function (state) {
    return [/*#__PURE__*/_react["default"].createElement(_index["default"], {
      textValue: state.textValue,
      handleChangeText: handleChangeText,
      fontValue: state.fontValue,
      fonts: mockedFontsList,
      handleChangeFont: handleChangeFont,
      minSize: 8,
      maxSize: 12,
      fontSizeValue: state.fontSizeValue,
      key: state.fontValue,
      incrementFontSize: incrementFontSize,
      decrementFontSize: decrementFontSize
    })];
  });
});