You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/07/12 20:05:48 UTC

[GitHub] [superset] pkdotson commented on a change in pull request #15618: refactor: icon to icons for syntaxhighlighter and querylist components

pkdotson commented on a change in pull request #15618:
URL: https://github.com/apache/superset/pull/15618#discussion_r668068870



##########
File path: superset-frontend/src/views/CRUD/data/query/QueryList.tsx
##########
@@ -80,17 +86,16 @@ const StyledPopoverItem = styled.div`
   color: ${({ theme }) => theme.colors.grayscale.dark2};
 `;
 
-const StatusIcon = styled(Icon, {
-  shouldForwardProp: prop => prop !== 'status',
-})<{ status: string }>`
-  color: ${({ status, theme }) => {
-    if (status === 'success') return theme.colors.success.base;
-    if (status === 'failed') return theme.colors.error.base;
-    if (status === 'running') return theme.colors.primary.base;
-    if (status === 'offline') return theme.colors.grayscale.light1;
+const getColor = (theme: SupersetTheme, status: string) => {
+  if (status === 'success') return theme.colors.success.base;
+  if (status === 'failed') return theme.colors.error.base;
+  if (status === 'running') return theme.colors.primary.base;
+  if (status === 'offline') return theme.colors.grayscale.light1;
+  return theme.colors.grayscale.base;
+};
 
-    return theme.colors.grayscale.base;
-  }};
+const StatusIcon = (theme: SupersetTheme, status: string) => css`

Review comment:
       Deleting the function will make getting the status color of the icons a little less dynamic since they are being used more than once in a couple of the icons. 

##########
File path: superset-frontend/src/views/CRUD/data/query/QueryList.tsx
##########
@@ -325,7 +318,13 @@ function QueryList({ addDangerToast, addSuccessToast }: QueryListProps) {
         }: any) => (
           <Tooltip title={t('Open query in SQL Lab')} placement="bottom">
             <a href={`/superset/sqllab?queryId=${id}`}>
-              <Icon name="full" />
+              <Icons.Full

Review comment:
       changing. I did this becasue I thought adding useTheme would break the tests for the querylist but it doesn't look like it.

##########
File path: superset-frontend/src/views/CRUD/data/query/QueryList.tsx
##########
@@ -325,7 +318,13 @@ function QueryList({ addDangerToast, addSuccessToast }: QueryListProps) {
         }: any) => (
           <Tooltip title={t('Open query in SQL Lab')} placement="bottom">
             <a href={`/superset/sqllab?queryId=${id}`}>
-              <Icon name="full" />
+              <Icons.Full

Review comment:
       changing. I did this becasue I thought adding useTheme would break the tests for the querylist but it doesn't look like it.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org