import * as tslib_1 from "tslib";
import * as React from 'react';
import { useState } from 'react';
import classnames from 'classnames';
import Sider from './sider';
import SiderContext from './sider-context';
var defaultProps = {
    prefixCls: 'ty-layout',
};
var BasicLayout = function (props) {
    var prefixCls = props.prefixCls, className = props.className, style = props.style, children = props.children, restProps = tslib_1.__rest(props, ["prefixCls", "className", "style", "children"]);
    var cls = classnames(prefixCls, className);
    return React.createElement("div", tslib_1.__assign({ className: cls, style: style }, restProps), children);
};
var Layout = function (props) {
    var _a;
    var prefixCls = props.prefixCls, className = props.className, style = props.style, children = props.children, restProps = tslib_1.__rest(props, ["prefixCls", "className", "style", "children"]);
    var _b = useState(false), hasSider = _b[0], setHasSider = _b[1];
    var cls = classnames(prefixCls, className, (_a = {},
        _a[prefixCls + "_has-sider"] = hasSider,
        _a));
    return (React.createElement(SiderContext.Provider, { value: { addSider: function () { return setHasSider(true); }, removeSider: function () { return setHasSider(false); } } },
        React.createElement("div", tslib_1.__assign({ className: cls, style: style }, restProps), children)));
};
var layoutGenerator = function (props) {
    return function (layoutProps) {
        return (React.createElement(BasicLayout, tslib_1.__assign({}, layoutProps, { prefixCls: props.prefixCls })));
    };
};
var Header = layoutGenerator({ prefixCls: 'ty-layout-header' });
var Footer = layoutGenerator({ prefixCls: 'ty-layout-footer' });
var Content = layoutGenerator({ prefixCls: 'ty-layout-content' });
Layout.defaultProps = defaultProps;
Layout.Header = Header;
Layout.Footer = Footer;
Layout.Content = Content;
Layout.Sider = Sider;
export default Layout;
//# sourceMappingURL=index.js.map