mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
refactor: icon to icons in erroralert component (#15341)
* initial commit * initial commit * lint
This commit is contained in:
parent
a477505291
commit
a3f4e4ad9e
@ -47,11 +47,9 @@ test('should render', () => {
|
||||
|
||||
test('should render warning icon', () => {
|
||||
render(<ErrorAlert {...mockedProps} />);
|
||||
expect(screen.getByTestId('icon')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('icon')).toHaveAttribute(
|
||||
'data-name',
|
||||
'warning-solid',
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('img', { name: 'warning-solid' }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should render error icon', () => {
|
||||
@ -60,11 +58,7 @@ test('should render error icon', () => {
|
||||
level: 'error' as ErrorLevel,
|
||||
};
|
||||
render(<ErrorAlert {...errorProps} />);
|
||||
expect(screen.getByTestId('icon')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('icon')).toHaveAttribute(
|
||||
'data-name',
|
||||
'error-solid',
|
||||
);
|
||||
expect(screen.getByRole('img', { name: 'error-solid' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should render the error title', () => {
|
||||
|
@ -22,7 +22,7 @@ import { noOp } from 'src/utils/common';
|
||||
import Modal from 'src/components/Modal';
|
||||
import Button from 'src/components/Button';
|
||||
|
||||
import Icon from '../Icon';
|
||||
import Icons from 'src/components/Icons';
|
||||
import { ErrorLevel, ErrorSource } from './types';
|
||||
import CopyToClipboard from '../CopyToClipboard';
|
||||
|
||||
@ -106,11 +106,17 @@ export default function ErrorAlert({
|
||||
<ErrorAlertDiv level={level} role="alert">
|
||||
<div className="top-row">
|
||||
<LeftSideContent>
|
||||
<Icon
|
||||
{level === 'error' ? (
|
||||
<Icons.ErrorSolid
|
||||
className="icon"
|
||||
name={level === 'error' ? 'error-solid' : 'warning-solid'}
|
||||
color={supersetTheme.colors[level].base}
|
||||
iconColor={supersetTheme.colors[level].base}
|
||||
/>
|
||||
) : (
|
||||
<Icons.WarningSolid
|
||||
className="icon"
|
||||
iconColor={supersetTheme.colors[level].base}
|
||||
/>
|
||||
)}
|
||||
<strong>{title}</strong>
|
||||
</LeftSideContent>
|
||||
{!isExpandable && (
|
||||
@ -163,11 +169,17 @@ export default function ErrorAlert({
|
||||
onHide={() => setIsModalOpen(false)}
|
||||
title={
|
||||
<div className="header">
|
||||
<Icon
|
||||
{level === 'error' ? (
|
||||
<Icons.ErrorSolid
|
||||
className="icon"
|
||||
name={level === 'error' ? 'error-solid' : 'warning-solid'}
|
||||
color={supersetTheme.colors[level].base}
|
||||
iconColor={supersetTheme.colors[level].base}
|
||||
/>
|
||||
) : (
|
||||
<Icons.WarningSolid
|
||||
className="icon"
|
||||
iconColor={supersetTheme.colors[level].base}
|
||||
/>
|
||||
)}
|
||||
<div className="title">{title}</div>
|
||||
</div>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user