import PageError from "../Error/PageError";
import PageLoader from "../Loader/PageLoader";
import OfflineIndicator from "../Offline/OfflineIndicator";
import TopSection from "../TopSection/TopSection";
import React from "react";
const MasterPage = (props) => {
    const [isOnline, setIsOnline] = React.useState(true);
    if (props.isLoading) {
        return (React.createElement(React.Fragment, null,
            React.createElement(PageLoader, { isVisible: true })));
    }
    if (props.error) {
        return (React.createElement(React.Fragment, null,
            React.createElement(PageError, { message: props.error })));
    }
    return (React.createElement(React.Fragment, null,
        isOnline && (React.createElement("div", { className: props.className },
            React.createElement("div", { className: props.makeTopSectionUnstick ? "" : "sticky top-0 z-10" },
                React.createElement(TopSection, { hideHeader: props.hideHeader, className: props.topSectionClassName, header: props.header, navbar: props.navBar })),
            props.children,
            props.footer && props.footer)),
        React.createElement(OfflineIndicator, { onOnlineOfflineChange: (isOnline) => {
                return setIsOnline(isOnline);
            } })));
};
export default MasterPage;
//# sourceMappingURL=MasterPage.js.map