"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var SideBar = /** @class */ (function (_super) {
    __extends(SideBar, _super);
    function SideBar() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.state = {
            searchString: ''
        };
        _this.handleSearchStringChange = function (event) {
            _this.setState({ searchString: event.target.value });
        };
        _this.clearSearchString = function () {
            _this.setState({ searchString: '' });
        };
        return _this;
    }
    SideBar.prototype.render = function () {
        var _this = this;
        return (React.createElement(React.Fragment, null,
            React.createElement("section", { className: "hero" },
                React.createElement("div", { className: "container" },
                    React.createElement("div", { className: "row" },
                        React.createElement("div", { className: "col-lg-8" },
                            React.createElement("div", { className: "hero__search__form" },
                                React.createElement("div", null,
                                    React.createElement("input", { onChange: function (e) {
                                            _this.handleSearchStringChange(e);
                                            if (e.target.value === '' && _this.state.searchString !== '') {
                                                _this.props.onSearchClick('');
                                            }
                                        }, onKeyDown: function (e) {
                                            if (e.key === "Enter" && _this.state.searchString !== '') {
                                                _this.props.onSearchClick(_this.state.searchString);
                                            }
                                        }, value: this.state.searchString, className: "search__form__input", type: "text", placeholder: "N\u00E1zev produktu, kategorie ..." }),
                                    this.state.searchString.length > 0
                                        ? React.createElement("button", { className: "search__form__clear__button", onClick: function () { _this.clearSearchString(); _this.props.onSearchClick(''); } },
                                            React.createElement("i", { className: "fas fa-times" }))
                                        : null,
                                    React.createElement("button", { onClick: function () {
                                            if (_this.state.searchString !== '') {
                                                _this.props.onSearchClick(_this.state.searchString);
                                            }
                                        }, className: "search__form__button site-btn" }, "VYHLEDAT")))),
                        React.createElement("div", { className: "col-lg-4" },
                            React.createElement("div", { className: "hero__search__phone" },
                                React.createElement("div", { className: "hero__search__phone__icon" },
                                    React.createElement("i", { className: "fa fa-phone" })),
                                React.createElement("div", { className: "hero__search__phone__text" },
                                    React.createElement("h5", null, "+420 565 382 371"),
                                    React.createElement("span", null, "Po-P\u00E1: 8:00/16:00")))))))));
    };
    return SideBar;
}(React.Component));
exports.default = SideBar;
//# sourceMappingURL=sideBar.js.map