0.1.2 • Published 9 years ago

react-antd-window v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

react-antd-window

Antd window component, wrap around react-window-kit.

Install

npm install --save react-antd-window

Usage

Modal

class ModalDemo extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            show: false
        }
    }

    render() {
        return (
            <div>
                <button onClick={this.openWindow.bind(this)}>open modal</button>
                <Modal
                    visible={this.state.show}
                    size='lg'
                    header='Title'
                    onHide={this.closeWindow.bind(this)}
                    onCancel={this.closeWindow.bind(this)}
                    onConfirm={this.closeWindow.bind(this)}
                    >
                    <h3>Hello Modal!</h3>
                </Modal>
            </div>
        )
    }

    openWindow() {
        this.setState({
            show: true
        })
    }

    closeWindow() {
        this.setState({
            show: false
        })
    }
}
React.render(<ModalDemo/>, document.getElementById('modal-demo'));

modal

Confirm

class ConfirmDemo extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            show: false
        }
    }

    render() {
        return (
            <div>
                <button onClick={this.openWindow.bind(this)}>open confirm</button>
                <Confirm
                    visible={this.state.show}
                    title='Are you sure!'
                    onCancel={this.closeWindow.bind(this)}
                    onOk={this.closeWindow.bind(this)}
                    >
                    Hello Modal! Hello Modal! Hello Modal! Hello Modal! Hello Modal!
                </Confirm>
            </div>
        )
    }

    openWindow() {
        this.setState({
            show: true
        })
    }

    closeWindow() {
        this.setState({
            show: false
        })
    }
}
React.render(<ConfirmDemo/>, document.getElementById('confirm-demo'));

Confirm

Tip

class ConfirmTip extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            show: false
        }
    }

    render() {
        return (
            <div>
                <button onClick={this.openWindow.bind(this)}>open tip</button>
                <Tip
                    visible={this.state.show}
                    type='info'
                    title='Are you sure!'
                    onOk={this.closeWindow.bind(this)}
                    >
                    Hello Modal! Hello Modal! Hello Modal! Hello Modal! Hello Modal!
                </Tip>
            </div>
        )
    }

    openWindow() {
        this.setState({
            show: true
        })
    }

    closeWindow() {
        this.setState({
            show: false
        })
    }
}
React.render(<ConfirmTip/>, document.getElementById('tip-demo'));

Tip

API

Window

nametypedefaultdescription
visibleBooleanfalsewhether show window
positionObject{align: 'cc', offset: [0, 0]}Align option values: tr, tc, tl, cl, cc, cr, bl, bc, br.
sizeObjectwidth, height
closableBooleantrue
maximizableBooleanfalse
backdropBooleantrue
keyboardBooleantrue
animationBoolean/ReactComponent
onAlignfunction
onShownfunction
onHidefunction
onHiddenfunction

Modal

nametypedefaultdescription
visibleBooleanfalsewhether show modal
sizeStringmdfl: full screen, lg, md, sm
headerReactElement
footerReactElement
onHidefunction

Confirm

nametypedefaultdescription
visibleBooleanfalsewhether show confirm
titleString
onCancelfunction
onOkfunction

Tip

nametypedefaultdescription
visibleBooleanfalsewhether show Tip
typeStringinfoinfo, success, warning, danger
titleString
onOkfunction

License

react-antd-window is released under the MIT license.