Move loadingStatus code into StandaloneLayout (where it belongs!)

This commit is contained in:
Kyle Shockey
2017-04-14 19:01:57 -07:00
parent 208694e9a8
commit 81f74d9d51
7 changed files with 32 additions and 27 deletions

View File

@@ -13,7 +13,7 @@ export default class StandaloneLayout extends React.Component {
}
render() {
let { getComponent } = this.props
let { getComponent, specSelectors } = this.props
let Container = getComponent("Container")
let Row = getComponent("Row")
@@ -23,11 +23,28 @@ export default class StandaloneLayout extends React.Component {
const BaseLayout = getComponent("BaseLayout", true)
const OnlineValidatorBadge = getComponent("onlineValidatorBadge", true)
const loadingStatus = specSelectors.loadingStatus()
return (
<Container className='swagger-ui'>
{ Topbar ? <Topbar/> : null }
<BaseLayout></BaseLayout>
{ loadingStatus === "loading" &&
<div className="info">
<h4 className="title">Loading...</h4>
</div>
}
{ loadingStatus === "failed" &&
<div className="info">
<h4 className="title">Failed to load spec.</h4>
</div>
}
{ loadingStatus === "failedConfig" &&
<div className="info" style={{ maxWidth: "880px", marginLeft: "auto", marginRight: "auto", textAlign: "center" }}>
<h4 className="title">Failed to load config.</h4>
</div>
}
{ !loadingStatus || loadingStatus === "success" && <BaseLayout/> }
<Row>
<Col>
<OnlineValidatorBadge />