Skip to content

Commit d04573e

Browse files
committed
feat: 🎸 show spinner while shring panels are loading
1 parent 4be37b9 commit d04573e

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import * as React from 'react';
8+
import { EuiSpacer, EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';
9+
10+
export const PanelSpinner: React.FC = (props) => {
11+
return (
12+
<>
13+
<EuiSpacer />
14+
<EuiFlexGroup justifyContent="spaceAround">
15+
<EuiFlexItem grow={false}>
16+
<EuiLoadingSpinner size="l" />
17+
</EuiFlexItem>
18+
</EuiFlexGroup>
19+
<EuiSpacer />
20+
</>
21+
);
22+
};

‎x-pack/plugins/reporting/public/components/reporting_panel_content_lazy.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import * as React from 'react';
88
import { lazy, Suspense, FC } from 'react';
9+
import { PanelSpinner } from './panel_spinner';
910
import type { Props } from './reporting_panel_content';
1011

1112
const LazyComponent = lazy(() =>
@@ -16,7 +17,7 @@ const LazyComponent = lazy(() =>
1617

1718
export const ReportingPanelContent: FC<Omit<Props, 'intl'>> = (props) => {
1819
return (
19-
<Suspense fallback={null}>
20+
<Suspense fallback={<PanelSpinner />}>
2021
<LazyComponent {...props} />
2122
</Suspense>
2223
);

‎x-pack/plugins/reporting/public/components/screen_capture_panel_content_lazy.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import * as React from 'react';
88
import { lazy, Suspense, FC } from 'react';
9+
import { PanelSpinner } from './panel_spinner';
910
import type { Props } from './screen_capture_panel_content';
1011

1112
const LazyComponent = lazy(() =>
@@ -16,7 +17,7 @@ const LazyComponent = lazy(() =>
1617

1718
export const ScreenCapturePanelContent: FC<Props> = (props) => {
1819
return (
19-
<Suspense fallback={null}>
20+
<Suspense fallback={<PanelSpinner />}>
2021
<LazyComponent {...props} />
2122
</Suspense>
2223
);

0 commit comments

Comments
 (0)