add styles to "loading..." elements

This commit is contained in:
Andrea Franz 2020-05-18 14:09:20 +02:00
parent b998378131
commit cb6762d5b7
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
3 changed files with 34 additions and 13 deletions

View File

@ -34,14 +34,6 @@ export default function(ownProps: any) {
} }
}, shallowEqual); }, shallowEqual);
if (props.error) {
return <>Error: {props.error}</>;
}
if (!props.initialized) {
return <>initializing...</>;
}
const sidebarClass = classNames({ const sidebarClass = classNames({
sidebar: true, sidebar: true,
open: props.sidebarOpen, open: props.sidebarOpen,
@ -56,8 +48,17 @@ export default function(ownProps: any) {
Web3 Type: {web3Type(props.type)} <br /> Web3 Type: {web3Type(props.type)} <br />
</div> </div>
</div> </div>
<div className="content">
{props.error && <div className={classNames({ paper: true, error: true })}>
{props.error}
</div>}
{!props.initialized && <div className={classNames({ paper: true })}>
initializing...
</div>}
{!props.error && props.initialized && <div className="content">
{ownProps.children} {ownProps.children}
</div> </div>}
</div>; </div>;
} }

View File

@ -109,15 +109,21 @@ export default function(ownProps: any) {
}, [dispatch, bucketAddress, recipientAddress]); }, [dispatch, bucketAddress, recipientAddress]);
if (props.error) { if (props.error) {
return <>Error: {buckerErrorMessage(props.error)}</>; return <div className={classNames({ paper: true, error: true })}>
{buckerErrorMessage(props.error)}
</div>;
} }
if (props.loading) { if (props.loading) {
return <>loading bucket...</>; return <div className={classNames({ paper: true })}>
loading bucket...
</div>;
} }
if (props.token === undefined) { if (props.token === undefined) {
return <>loading token info...</>; return <div className={classNames({ paper: true })}>
loading token info...
</div>;
} }
const erc20Header = (token: TokenERC20) => { const erc20Header = (token: TokenERC20) => {

View File

@ -65,4 +65,18 @@ body {
.main { .main {
margin-top: 50px; margin-top: 50px;
.paper {
margin: 0 auto;
padding: 12px;
background: #fff;
color: #1a1a1a;
width: 400px;
border-radius: 4px;
text-align: center;
&.error {
color: red;
}
}
} }