import Button from '../../button';
import Dialog from '..';
import React from 'react';
import ReactDOM from 'react-dom';
import Switch from '../../switch';
const shortContent = (React.createElement("p", null, "Start your business here by searching a popular product"));
const longContent = [
    React.createElement("p", { key: "0" }, "Start your business here by searching a popular product"),
    React.createElement("p", { key: "1" }, "Start your business here by searching a popular product"),
    React.createElement("p", { key: "2" }, "Start your business here by searching a popular product"),
    React.createElement("p", { key: "3" }, "Start your business here by searching a popular product"),
];
class App extends React.Component {
    constructor() {
        super(...arguments);
        this.state = {
            visible: false,
            short: true,
            shouldUpdatePosition: true,
        };
        this.onOpen = () => {
            this.setState({
                visible: true,
                short: true,
            });
        };
        this.onClose = () => {
            this.setState({
                visible: false,
            });
        };
        this.toggleShouldUpdatePosition = () => {
            this.setState({
                shouldUpdatePosition: !this.state.shouldUpdatePosition,
            });
        };
        this.modifyContent = () => {
            this.setState({
                short: !this.state.short,
            });
        };
    }
    render() {
        const { visible, short, shouldUpdatePosition } = this.state;
        return (React.createElement("div", null,
            React.createElement("div", { style: { display: 'block', marginBottom: '10px' } }, "Whether to update the dialog position when the dialog height changes"),
            React.createElement(Switch, { style: { display: 'block', marginBottom: '10px', width: '60px' }, checked: shouldUpdatePosition, onChange: this.toggleShouldUpdatePosition }),
            React.createElement(Button, { onClick: this.onOpen, type: "primary" }, "Open dialog"),
            React.createElement(Dialog, { title: "Welcome to Alibaba.com", visible: visible, onOk: this.onClose.bind(this, 'okClick'), onCancel: this.onClose.bind(this, 'cancelClick'), onClose: this.onClose, shouldUpdatePosition: shouldUpdatePosition },
                React.createElement(Button, { type: "primary", onClick: this.modifyContent }, "Change content"),
                short ? shortContent : longContent)));
    }
}
ReactDOM.render(React.createElement(App, null), document.getElementById('dialog-demo-5'));
