1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/ui/loading-screen/loading-screen.component.js
George Marshall 8fcbebc546
Update design tokens library from 1.5 to 1.6 WIP (#14732)
* Updating account menu icon color

* Updating design-tokens and making appropriate updates to extension styles

* Adding more deprecated tags to colors

* Adding spinner and removing todo comment

* Remove comment

* Updates

* Updating snapshots

* More color and ui updates

* reverting transition change
2022-05-25 08:35:36 -07:00

50 lines
1.1 KiB
JavaScript

import React, { Component, isValidElement } from 'react';
import PropTypes from 'prop-types';
import Spinner from '../spinner';
class LoadingScreen extends Component {
static defaultProps = {
loadingMessage: null,
showLoadingSpinner: true,
};
static propTypes = {
loadingMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
showLoadingSpinner: PropTypes.bool,
header: PropTypes.element,
};
renderMessage() {
const { loadingMessage } = this.props;
if (!loadingMessage) {
return null;
}
return isValidElement(loadingMessage) ? (
loadingMessage
) : (
<span>{loadingMessage}</span>
);
}
render() {
return (
<div className="loading-overlay">
{this.props.header}
<div className="loading-overlay__container">
{this.props.showLoadingSpinner && (
<Spinner
color="var(--color-warning-default)"
className="loading-overlay__spinner"
/>
)}
{this.renderMessage()}
</div>
</div>
);
}
}
export default LoadingScreen;