"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WeeklyDayPickerInlineExample = void 0;
var tslib_1 = require("tslib");
var React = require("react");
var react_1 = require("@fluentui/react");
var styles = require("./WeeklyDayPicker.Example.scss");
var Button_1 = require("@fluentui/react/lib-commonjs/Button");
var WeeklyDayPickerInlineExample = /** @class */ (function (_super) {
    tslib_1.__extends(WeeklyDayPickerInlineExample, _super);
    function WeeklyDayPickerInlineExample(props) {
        var _this = _super.call(this, props) || this;
        _this._onSelectDate = function (date) {
            _this.setState(function (prevState) {
                return {
                    selectedDate: date,
                };
            });
        };
        _this._goPrevious = function () {
            if (_this.state && _this.state.selectedDate) {
                _this._onSelectDate(react_1.addDays(_this.state.selectedDate, -1));
            }
        };
        _this._goNext = function () {
            if (_this.state && _this.state.selectedDate) {
                _this._onSelectDate(react_1.addDays(_this.state.selectedDate, 1));
            }
        };
        _this.state = {
            selectedDate: new Date(),
        };
        return _this;
    }
    WeeklyDayPickerInlineExample.prototype.render = function () {
        return (React.createElement("div", { className: styles.wrapper },
            React.createElement("div", null,
                "Selected date(s):",
                ' ',
                React.createElement("span", null, !this.state.selectedDate ? 'Not set' : this.state.selectedDate.toLocaleString())),
            React.createElement(react_1.WeeklyDayPicker, { onSelectDate: this._onSelectDate, firstDayOfWeek: react_1.DayOfWeek.Wednesday, strings: react_1.defaultWeeklyDayPickerStrings, initialDate: this.state.selectedDate }),
            React.createElement("div", null,
                React.createElement(Button_1.DefaultButton, { className: styles.button, onClick: this._goPrevious, text: "Previous" }),
                React.createElement(Button_1.DefaultButton, { className: styles.button, onClick: this._goNext, text: "Next" }))));
    };
    return WeeklyDayPickerInlineExample;
}(React.Component));
exports.WeeklyDayPickerInlineExample = WeeklyDayPickerInlineExample;
//# sourceMappingURL=WeeklyDayPicker.Inline.Example.js.map