Set / set width and height in afterburner mode

How to apply dynamic width and height to action-bootstrap modal window? I checked the reaction-bootstrap documentation here , but couldn't figure out how to do this. In fact, the value of the width and height props will be dynamic (can be any values), since it will be a reusable component in my application (which will be used on many pages), so width / height cannot be applied through some CSS class.

'bsSize', as indicated in the docs, also does not work, although the predefined sizes xs, md, lg are not what I definitely want, instead I need the width and height to be set to modal through the details.

Here is my sample JSX code:

var MyWindow = React.createClass({
    getInitialState() {
        return { show: true };
    },
    close() {
        this.setState({ show: false });
    },
    open() {
        this.setState({ show: true });
    },
    save() {

    },
    render: function () {

        var Button = ReactBootstrap.Button,
            Modal = ReactBootstrap.Modal,
            ModalBody = ReactBootstrap.ModalBody,
            ModalHeader = ReactBootstrap.ModalHeader,
            ModalFooter = ReactBootstrap.ModalFooter,
            ModalTitle = ReactBootstrap.ModalTitle;

        return (
            <Modal show={this.state.show} onHide={this.close}>
                <ModalHeader closeButton>
                    <ModalTitle>My Cool Window</ModalTitle>
                </ModalHeader>
                <ModalBody>
                    <h4>Text in a modal</h4>
                    <p>Duis mollis, est non commodo luctus</p>
                </ModalBody>
                <ModalFooter>
                    <Button onClick={this.close}>Cancel</Button>
                    <Button bsStyle="primary" onClick={this.save}>Save</Button>
                </ModalFooter>
            </Modal>
        );

    }
});

React.render(<MyWindow width={700} height={400} />, mountNode);
+4
1

, css , modal prop dialogClassName.

, my.jsx:

<Modal dialogClassName="my-modal">
</Modal>

my.css :

.my-modal {
    width: 90vw    /* Occupy the 90% of the screen width */
} 

custmized modal!

+4

Source: https://habr.com/ru/post/1607767/


All Articles