"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 (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var ReactDOM = __importStar(require("react-dom"));
var features_1 = require("../features");
var styledComponents_1 = require("./styledComponents");
var textComponents_1 = require("./textComponents");
var NavLink_1 = require("./NavLink");
var NavDropDown_1 = require("./NavDropDown");
var NavMenuResponsiveToggleButton_1 = require("./NavMenuResponsiveToggleButton");
var NavMenuLinksComponent = function (props) {
    var mobileOnClickProp = {};
    if (props.closeDrawer) {
        mobileOnClickProp = { onClick: props.closeDrawer };
    }
    return (React.createElement(React.Fragment, null,
        React.createElement(NavDropDown_1.NavDropDown, { label: React.createElement(NavLink_1.NavLink, __assign({ to: "/registry" }, mobileOnClickProp),
                React.createElement(textComponents_1.NavLinkRegistryText, null)) },
            React.createElement(NavLink_1.NavLink, __assign({ to: "/registry" }, mobileOnClickProp),
                React.createElement(textComponents_1.NavLinkRegistryHomeText, null)),
            React.createElement(NavLink_1.NavLink, __assign({ to: "/parameterizer" }, mobileOnClickProp),
                React.createElement(textComponents_1.NavLinkParameterizerText, null)),
            React.createElement(NavLink_1.NavLink, __assign({ to: "/contract-addresses" }, mobileOnClickProp),
                React.createElement(textComponents_1.NavLinkContractAddressesText, null))),
        React.createElement(features_1.FeatureFlag, { feature: "boosts-mvp" },
            React.createElement(NavLink_1.NavLink, __assign({ to: "/boosts" }, mobileOnClickProp),
                React.createElement(textComponents_1.NavLinkBoostsText, null))),
        React.createElement(NavLink_1.NavLink, { href: "https://civil.co/constitution/" },
            React.createElement(textComponents_1.NavLinkConstitutionText, null)),
        React.createElement(NavLink_1.NavLink, { href: "https://civilfound.org/" },
            React.createElement(textComponents_1.NavLinkFoundationText, null)),
        React.createElement(NavLink_1.NavLink, { href: "https://help.civil.co/" },
            React.createElement(textComponents_1.NavLinkFaqText, null))));
};
var NavMenuResponsiveDrawer = /** @class */ (function (_super) {
    __extends(NavMenuResponsiveDrawer, _super);
    function NavMenuResponsiveDrawer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.bucket = document.createElement("div");
        return _this;
    }
    NavMenuResponsiveDrawer.prototype.componentDidMount = function () {
        document.body.appendChild(this.bucket);
    };
    NavMenuResponsiveDrawer.prototype.componentWillUnmount = function () {
        document.body.removeChild(this.bucket);
    };
    NavMenuResponsiveDrawer.prototype.render = function () {
        if (!this.props.isResponsiveDrawerOpen) {
            return null;
        }
        var mobileNavMenu = (React.createElement(React.Fragment, null,
            React.createElement(styledComponents_1.StyledMobileNavMenu, null,
                React.createElement(NavMenuLinksComponent, __assign({}, this.props)))));
        return ReactDOM.createPortal(mobileNavMenu, this.bucket);
    };
    return NavMenuResponsiveDrawer;
}(React.Component));
var NavMenu = /** @class */ (function (_super) {
    __extends(NavMenu, _super);
    function NavMenu(props) {
        var _this = _super.call(this, props) || this;
        _this.toggleResponsiveMenuDrawer = function () {
            _this.setState({ isResponsiveDrawerOpen: !_this.state.isResponsiveDrawerOpen });
        };
        _this.closeResponsiveMenuDrawer = function () {
            _this.setState({ isResponsiveDrawerOpen: false });
        };
        _this.state = {
            isResponsiveDrawerOpen: false,
        };
        return _this;
    }
    NavMenu.prototype.render = function () {
        var _this = this;
        return (React.createElement(React.Fragment, null,
            React.createElement(styledComponents_1.StyledNavMenuContainer, null,
                React.createElement(NavMenuLinksComponent, null)),
            React.createElement(NavMenuResponsiveToggleButton_1.NavMenuResponsiveToggleButton, { isResponsiveDrawerOpen: this.state.isResponsiveDrawerOpen, onClick: function () { return _this.toggleResponsiveMenuDrawer(); } }),
            React.createElement(styledComponents_1.StyledNavMenuResponsiveContainer, null,
                React.createElement(NavMenuResponsiveDrawer, { isResponsiveDrawerOpen: this.state.isResponsiveDrawerOpen, closeDrawer: this.closeResponsiveMenuDrawer }))));
    };
    return NavMenu;
}(React.Component));
exports.NavMenu = NavMenu;
//# sourceMappingURL=NavMenu.js.map