Address feedback
This commit is contained in:
parent
58ce56684d
commit
a288afbf68
|
@ -1,27 +1,35 @@
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import {Form, Button} from 'tabler-react';
|
||||||
|
|
||||||
class ApplicationPreviewContainer extends React.Component {
|
class ApplicationPreviewContainer extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
// TODO(andremedeiros): Figure out how to pull this from the actual host.
|
|
||||||
previewUrl: this.props.previewHomepage
|
previewUrl: this.props.previewHomepage
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<Form.Group>
|
||||||
<div className="input-group mb-3">
|
<Form.InputGroup>
|
||||||
<input type="text" className="form-control" placeholder="URL" value={this.state.previewUrl} onChange={(e) => this.handlePreviewUrlChange(e)} />
|
<Form.Input placeholder="URL"
|
||||||
<div className="input-group-append">
|
value={this.state.previewUrl}
|
||||||
<button className="btn btn-outline-secondary" type="button" onClick={(e) => this.handlePreviewGo(e)}>Go</button>
|
className="form-control"
|
||||||
</div>
|
onChange={(e) => this.handlePreviewUrlChange(e)} />
|
||||||
</div>
|
<Form.InputGroupAppend>
|
||||||
<iframe width="100%" height="500" title="Preview" ref={(iframe) => this.previewIframe = iframe} onLoad={(e) => this.handlePreviewChange(e)} src={this.props.previewHomepage}></iframe>
|
<Button color="primary" onClick={(e) => this.handlePreviewGo(e)}>Go</Button>
|
||||||
</div>
|
</Form.InputGroupAppend>
|
||||||
|
</Form.InputGroup>
|
||||||
|
<iframe width="100%"
|
||||||
|
height="500"
|
||||||
|
title="Preview"
|
||||||
|
ref={(iframe) => this.previewIframe = iframe}
|
||||||
|
onLoad={(e) => this.handlePreviewChange(e)} src={this.props.previewHomepage}>
|
||||||
|
</iframe>
|
||||||
|
</Form.Group>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +56,7 @@ ApplicationPreviewContainer.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
ApplicationPreviewContainer.defaultProps = {
|
ApplicationPreviewContainer.defaultProps = {
|
||||||
previewHomepage: 'http://localhost:8000'
|
previewHomepage: window.location.protocol + '//' + window.location.host
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ApplicationPreviewContainer;
|
export default ApplicationPreviewContainer;
|
||||||
|
|
Loading…
Reference in New Issue