UI: Remove unused ErrorIndicator component (#75185)

Closes #75068
This commit is contained in:
kay delaney 2023-09-21 17:50:18 +01:00 committed by GitHub
parent 42cc6b1842
commit 70cb87380d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 77 deletions

View File

@ -1,48 +0,0 @@
import { css, cx } from '@emotion/css';
import React from 'react';
import { useStyles2 } from '../../themes';
import { commonColorsPalette } from '../../themes/default';
import { Icon } from '../Icon/Icon';
import { Tooltip } from '../Tooltip/Tooltip';
/**
* @internal
*/
export type ErrorIndicatorProps = {
error?: string;
onClick?: () => void;
};
/**
* @internal
*/
export const ErrorIndicator = ({ error, onClick }: ErrorIndicatorProps) => {
const styles = useStyles2(getStyles);
if (!error) {
return null;
}
return (
<Tooltip theme="error" content={error}>
<Icon
onClick={onClick}
className={cx(styles.icon, { [styles.clickable]: !!onClick })}
size="sm"
name="exclamation-triangle"
/>
</Tooltip>
);
};
const getStyles = () => {
return {
clickable: css({
cursor: 'pointer',
}),
icon: css({
color: `${commonColorsPalette.red88}`,
}),
};
};

View File

@ -186,16 +186,6 @@ export const Examples = () => {
menu,
loadingState: LoadingState.Loading,
})}
{renderPanel('Deprecated error indicator', {
title: 'Default title',
leftItems: [
<PanelChrome.ErrorIndicator
key="errorIndicator"
error="Error text"
onClick={action('ErrorIndicator: onClick fired')}
/>,
],
})}
{renderPanel('No padding, deprecated loading indicator', {
padding: 'none',
title: 'Default title',
@ -359,15 +349,8 @@ const Default: ReactNode = [];
const LoadingIcon = [
<PanelChrome.LoadingIndicator key="loadingIndicator" loading onCancel={action('LoadingIndicator: onCancel fired')} />,
];
const ErrorIcon = [
<PanelChrome.ErrorIndicator
key="errorIndicator"
error="Error text"
onClick={action('ErrorIndicator: onClick fired')}
/>,
];
const leftItems = { LoadingIcon, ErrorIcon, Default };
const leftItems = { LoadingIcon, Default };
const description =
'Description text with very long descriptive words that describe what is going on in the panel and not beyond. Or maybe beyond, not up to us.';
@ -381,7 +364,6 @@ Basic.argTypes = {
type: 'select',
labels: {
LoadingIcon: 'With loading icon',
ErrorIcon: 'With error icon',
Default: 'Default (no elements)',
},
},

View File

@ -1,6 +1,5 @@
import React from 'react';
import { ErrorIndicator } from './ErrorIndicator';
import { LoadingIndicator } from './LoadingIndicator';
import { PanelChrome as PanelChromeComponent, PanelChromeProps } from './PanelChrome';
import { TitleItem } from './TitleItem';
@ -15,7 +14,6 @@ export type { PanelChromeProps, PanelPadding } from './PanelChrome';
*/
export interface PanelChromeType extends React.FC<PanelChromeProps> {
LoadingIndicator: typeof LoadingIndicator;
ErrorIndicator: typeof ErrorIndicator;
TitleItem: typeof TitleItem;
}
@ -24,7 +22,6 @@ export interface PanelChromeType extends React.FC<PanelChromeProps> {
*/
export const PanelChrome = PanelChromeComponent as PanelChromeType;
PanelChrome.LoadingIndicator = LoadingIndicator;
PanelChrome.ErrorIndicator = ErrorIndicator;
PanelChrome.TitleItem = TitleItem;
/**
@ -36,11 +33,6 @@ export {
type LoadingIndicatorProps as PanelChromeLoadingIndicatorProps,
} from './LoadingIndicator';
export {
ErrorIndicator as PanelChromeErrorIndicator,
type ErrorIndicatorProps as PanelChromeErrorIndicatorProps,
} from './ErrorIndicator';
export { PanelDescription } from './PanelDescription';
export { usePanelContext, PanelContextProvider, type PanelContext, PanelContextRoot } from './PanelContext';

View File

@ -138,8 +138,6 @@ export {
type PanelChromeType,
PanelChromeLoadingIndicator,
type PanelChromeLoadingIndicatorProps,
PanelChromeErrorIndicator,
type PanelChromeErrorIndicatorProps,
PanelContextProvider,
type PanelContext,
PanelContextRoot,