@atlaskit/editor-plugin-extension
Version:
editor-plugin-extension plugin for @atlaskit/editor-core
38 lines (37 loc) • 1.31 kB
JavaScript
/**
* @jsxRuntime classic
* @jsx jsx
*/
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
import { css, jsx } from '@emotion/react';
import { injectIntl } from 'react-intl';
import { messages } from '@atlaskit/editor-common/extensions/messages';
import SectionMessage from '@atlaskit/section-message/message';
import Spinner from '@atlaskit/spinner/spinner';
const spinnerWrapperStyles = css({
display: 'flex',
justifyContent: 'center',
marginTop: "var(--ds-space-800, 64px)"
});
const errorWrapperStyles = css({
marginTop: "var(--ds-space-400, 32px)" // Add some padding to the top to make sure we place this below the offline status banner
});
const LoadingStateWithErrorHandling = injectIntl(props => {
if (props.error) {
return jsx("div", {
css: errorWrapperStyles,
"data-testid": "ConfigPanelLoadingError"
}, jsx(SectionMessage, {
appearance: "error"
}, props.intl.formatMessage(messages.panelLoadingError)));
}
return jsx("div", {
css: spinnerWrapperStyles,
"data-testid": "ConfigPanelLoading"
}, jsx(Spinner, {
size: "small",
interactionName: "config-panel-spinner"
}));
});
const LoadingState = props => LoadingStateWithErrorHandling(props);
export default LoadingState;