Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change spaces button loading design #197922

Merged
merged 7 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
visibility: hidden;
animation-play-state: paused;
}

.euiHeaderSectionItem .euiButtonEmpty__text {
// stop global header buttons from jumping during loading state
display: flex;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions x-pack/plugins/spaces/public/nav_control/nav_control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
* 2.0.
*/

import { EuiLoadingSpinner } from '@elastic/eui';
import { EuiSkeletonRectangle } from '@elastic/eui';
import { css } from '@emotion/react';
import React, { lazy, Suspense } from 'react';
import ReactDOM from 'react-dom';

import type { CoreStart } from '@kbn/core/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { euiThemeVars } from '@kbn/ui-theme';

import { initTour } from './solution_view_tour';
import type { EventTracker } from '../analytics';
Expand Down Expand Up @@ -40,7 +42,17 @@ export function initSpacesNavControl(

ReactDOM.render(
<KibanaRenderContextProvider {...core}>
<Suspense fallback={<EuiLoadingSpinner />}>
<Suspense
fallback={
<EuiSkeletonRectangle
css={css`
margin-inline: ${euiThemeVars.euiSizeS};
`}
borderRadius="m"
contentAriaLabel="Loading navigation"
/>
}
>
<LazyNavControlPopover
spacesManager={spacesManager}
serverBasePath={core.http.basePath.serverBasePath}
Expand Down
11 changes: 9 additions & 2 deletions x-pack/plugins/spaces/public/nav_control/nav_control_popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import type { PopoverAnchorPosition, WithEuiThemeProps } from '@elastic/eui';
import {
EuiHeaderSectionItemButton,
EuiLoadingSpinner,
EuiPopover,
EuiSkeletonRectangle,
withEuiTheme,
} from '@elastic/eui';
import React, { Component, lazy, Suspense } from 'react';
Expand Down Expand Up @@ -179,7 +179,14 @@ class NavControlPopoverUI extends Component<Props, State> {
}

private getAlignedLoadingSpinner() {
return <EuiLoadingSpinner size="m" className="eui-alignMiddle" />;
return (
<EuiSkeletonRectangle
borderRadius="m"
contentAriaLabel={i18n.translate('xpack.spaces.navControl.popover.loadingSpacesLabel', {
defaultMessage: 'Loading spaces navigation',
})}
/>
);
}

private getActiveSpaceButton = () => {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/spaces/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"@kbn/logging",
"@kbn/core-logging-browser-mocks",
"@kbn/core-http-router-server-mocks",
"@kbn/core-application-browser-mocks"
"@kbn/core-application-browser-mocks",
"@kbn/ui-theme"
],
"exclude": [
"target/**/*",
Expand Down