Better async loading behavior
This commit is contained in:
@@ -5,19 +5,14 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.PlaygroundContainer {
|
.PlaygroundContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Playground {
|
.playground-background {
|
||||||
display: flex;
|
|
||||||
flex-grow: 1;
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
background: linear-gradient(-90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
|
background: linear-gradient(-90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
|
||||||
linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
|
linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
|
||||||
linear-gradient(-90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
|
linear-gradient(-90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
|
||||||
@@ -41,6 +36,15 @@
|
|||||||
100px 100px, 100px 100px, 100px 100px;
|
100px 100px, 100px 100px, 100px 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Playground {
|
||||||
|
display: flex;
|
||||||
|
flex-grow: 1;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
animation: playground-content-fade-in-frames 50ms ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
.Playground > .YogaNode {
|
.Playground > .YogaNode {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
position: static;
|
position: static;
|
||||||
@@ -72,3 +76,12 @@
|
|||||||
.ant-modal-content {
|
.ant-modal-content {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes playground-content-fade-in-frames {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -235,8 +235,11 @@ export default class Playground extends Component<Props, State> {
|
|||||||
: null;
|
: null;
|
||||||
|
|
||||||
const playground = (
|
const playground = (
|
||||||
|
<div className="playground-background">
|
||||||
<div
|
<div
|
||||||
className={`Playground ${this.props.renderSidebar ? '' : 'standalone'}`}
|
className={`Playground ${
|
||||||
|
this.props.renderSidebar ? '' : 'standalone'
|
||||||
|
}`}
|
||||||
onMouseDown={this.onMouseDown}
|
onMouseDown={this.onMouseDown}
|
||||||
style={{height, maxHeight: height}}
|
style={{height, maxHeight: height}}
|
||||||
ref={ref => {
|
ref={ref => {
|
||||||
@@ -260,7 +263,9 @@ export default class Playground extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
onChangeLayout={this.onChangeLayout}
|
onChangeLayout={this.onChangeLayout}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
onChangeSetting={(key, value) => this.setState({[key]: value})}
|
onChangeSetting={(key, value) =>
|
||||||
|
this.setState({[key]: value})
|
||||||
|
}
|
||||||
direction={direction}
|
direction={direction}
|
||||||
onRemove={
|
onRemove={
|
||||||
selectedNodePath && selectedNodePath.length > 0
|
selectedNodePath && selectedNodePath.length > 0
|
||||||
@@ -282,6 +287,7 @@ export default class Playground extends Component<Props, State> {
|
|||||||
</Sidebar>
|
</Sidebar>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.props.renderSidebar) {
|
if (this.props.renderSidebar) {
|
||||||
|
@@ -38,16 +38,18 @@ const LazyPlayground = React.lazy(() => import('../components/Playground'));
|
|||||||
|
|
||||||
function ClientPlayground() {
|
function ClientPlayground() {
|
||||||
const fallback = <div className={styles.playgroundFallback} />;
|
const fallback = <div className={styles.playgroundFallback} />;
|
||||||
return <BrowserOnly fallback={fallback}>
|
|
||||||
|
return (
|
||||||
|
<BrowserOnly fallback={fallback}>
|
||||||
{() => (
|
{() => (
|
||||||
<Suspense fallback={fallback}>
|
<Suspense fallback={fallback}>
|
||||||
<LazyPlayground />
|
<LazyPlayground />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
)}
|
)}
|
||||||
</BrowserOnly>;
|
</BrowserOnly>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default function Home(): JSX.Element {
|
export default function Home(): JSX.Element {
|
||||||
const {siteConfig} = useDocusaurusContext();
|
const {siteConfig} = useDocusaurusContext();
|
||||||
return (
|
return (
|
||||||
|
Reference in New Issue
Block a user