diff --git a/docs/customization/plugin-api.md b/docs/customization/plugin-api.md
index db88ca71..245b5a14 100644
--- a/docs/customization/plugin-api.md
+++ b/docs/customization/plugin-api.md
@@ -293,7 +293,7 @@ const MyWrapSelectorsPlugin = function(system) {
Wrap Components allow you to override a component registered within the system.
-Wrap Components are function factories with the signature `(OriginalComponent, system) => props => ReactElement`.
+Wrap Components are function factories with the signature `(OriginalComponent, system) => props => ReactElement`. If you'd prefer to provide a React component class, `(OriginalComponent, system) => ReactClass` works as well.
```javascript
const MyWrapBuiltinComponentPlugin = function(system) {
@@ -310,9 +310,12 @@ const MyWrapBuiltinComponentPlugin = function(system) {
}
```
-```javascript
-// Overriding a component from a plugin
+Here's another example that includes a code sample of a component that will be wrapped:
+```javascript
+///// Overriding a component from a plugin
+
+// Here's our normal, unmodified component.
const MyNumberDisplayPlugin = function(system) {
return {
components: {
@@ -321,6 +324,7 @@ const MyNumberDisplayPlugin = function(system) {
}
}
+// Here's a component wrapper defined as a function.
const MyWrapComponentPlugin = function(system) {
return {
wrapComponents: {
@@ -328,6 +332,7 @@ const MyWrapComponentPlugin = function(system) {
if(props.number > 10) {
return
Warning! Big number ahead.
+
} else {
return
@@ -336,8 +341,30 @@ const MyWrapComponentPlugin = function(system) {
}
}
}
+
+// Alternatively, here's the same component wrapper defined as a class.
+const MyWrapComponentPlugin = function(system) {
+ return {
+ wrapComponents: {
+ NumberDisplay: (Original, system) => class WrappedNumberDisplay extends React.component {
+ render() {
+ if(props.number > 10) {
+ return
+
Warning! Big number ahead.
+
+
+ } else {
+ return
+ }
+ }
+ }
+ }
+ }
+}
```
+
+
##### fn
The fn interface allows you to add helper functions to the system for use elsewhere.
diff --git a/docs/usage/installation.md b/docs/usage/installation.md
index 63f7d233..e4fd09d2 100644
--- a/docs/usage/installation.md
+++ b/docs/usage/installation.md
@@ -49,7 +49,7 @@ const ui = SwaggerUIBundle({
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
- ]
+ ],
layout: "StandaloneLayout"
})
```
@@ -86,7 +86,7 @@ This will serve Swagger UI at `/swagger` instead of `/`.
You can embed Swagger-UI's code directly in your HTML by using unkpg's interface:
```html
-
```
diff --git a/src/core/components/layouts/base.jsx b/src/core/components/layouts/base.jsx
index 1f5a0788..235366f7 100644
--- a/src/core/components/layouts/base.jsx
+++ b/src/core/components/layouts/base.jsx
@@ -61,7 +61,18 @@ export default class BaseLayout extends React.Component {
const isSpecEmpty = !specSelectors.specStr()
if(isSpecEmpty) {
- return No spec provided.
+ let loadingMessage
+ if(isLoading) {
+ loadingMessage =
+ } else {
+ loadingMessage = No API definition provided.
+ }
+
+ return
}
return (
diff --git a/src/standalone/layout.jsx b/src/standalone/layout.jsx
index dc36b46e..30e46ccc 100644
--- a/src/standalone/layout.jsx
+++ b/src/standalone/layout.jsx
@@ -1,3 +1,5 @@
+
+
import React from "react"
import PropTypes from "prop-types"
@@ -32,17 +34,21 @@ export default class StandaloneLayout extends React.Component {
{ Topbar ? : null }
{ loadingStatus === "loading" &&
}
{ loadingStatus === "failed" &&
-
Failed to load spec.
+
+
Failed to load API definition.
+
}
{ loadingStatus === "failedConfig" &&
-
Failed to load config.
+ Failed to load remote configuration.
}
{ !loadingStatus || loadingStatus === "success" && }
diff --git a/src/style/_layout.scss b/src/style/_layout.scss
index 1d399f76..72109a73 100644
--- a/src/style/_layout.scss
+++ b/src/style/_layout.scss
@@ -653,6 +653,11 @@
.loading-container
{
padding: 40px 0 60px;
+ margin-top: 1em;
+ min-height: 1px;
+ display: flex;
+ justify-content: center;
+
.loading
{
position: relative;