Files
mattermostest/src/renderer/components/SaveButton/LoadingWrapper.tsx

30 lines
670 B
TypeScript

// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import LoadingSpinner from './LoadingSpinner';
type Props = {
loading: boolean;
text: React.ReactNode;
children: React.ReactNode;
}
export default class LoadingWrapper extends React.PureComponent<Props> {
public static defaultProps: Props = {
loading: true,
text: null,
children: null,
}
public render() {
const {text, loading, children} = this.props;
if (!loading) {
return children;
}
return <LoadingSpinner text={text}/>;
}
}