This is an automated email from the ASF dual-hosted git repository.

pkdotson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new a477505  refactor: icon to icons for basicerror componenet (#15336)
a477505 is described below

commit a477505291aa88bc5f1b35004ffca33d7320ade3
Author: Phillip Kelley-Dotson <[email protected]>
AuthorDate: Thu Jun 24 09:37:13 2021 -0700

    refactor: icon to icons for basicerror componenet (#15336)
    
    * initial commit
    
    * initial commit
    
    * fix test
    
    * lint fix
    
    * Update superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx
    
    Co-authored-by: David Aaron Suddjian 
<[email protected]>
    
    * lint
    
    Co-authored-by: David Aaron Suddjian 
<[email protected]>
---
 .../src/components/ErrorMessage/BasicErrorAlert.test.tsx   | 14 ++++----------
 .../src/components/ErrorMessage/BasicErrorAlert.tsx        | 11 ++++++-----
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git 
a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx 
b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx
index 99db37d..2233521 100644
--- a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx
+++ b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx
@@ -43,11 +43,9 @@ test('should render', () => {
 
 test('should render warning icon', () => {
   render(<BasicErrorAlert {...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', () => {
@@ -56,11 +54,7 @@ test('should render error icon', () => {
     level: 'error' as ErrorLevel,
   };
   render(<BasicErrorAlert {...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', () => {
diff --git a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx 
b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx
index 6c46009..0d5d993 100644
--- a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx
+++ b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx
@@ -18,7 +18,7 @@
  */
 import React from 'react';
 import { styled, supersetTheme } from '@superset-ui/core';
-import Icon from '../Icon';
+import Icons from 'src/components/Icons';
 import { ErrorLevel } from './types';
 
 const StyledContainer = styled.div<{ level: ErrorLevel }>`
@@ -56,10 +56,11 @@ export default function BasicErrorAlert({
 }: BasicErrorAlertProps) {
   return (
     <StyledContainer level={level} role="alert">
-      <Icon
-        name={level === 'error' ? 'error-solid' : 'warning-solid'}
-        color={supersetTheme.colors[level].base}
-      />
+      {level === 'error' ? (
+        <Icons.ErrorSolid iconColor={supersetTheme.colors[level].base} />
+      ) : (
+        <Icons.WarningSolid iconColor={supersetTheme.colors[level].base} />
+      )}
       <StyledContent>
         <StyledTitle>{title}</StyledTitle>
         <p>{body}</p>

Reply via email to