From 076f774daf3c0bad41b6f162e96f21949ddee1f7 Mon Sep 17 00:00:00 2001 From: Phillip Kelley-Dotson Date: Tue, 29 Jun 2021 00:32:54 -0700 Subject: [PATCH] refactor: icon to icons for lastupdated component (#15401) * intial commit * fix test * Update superset-frontend/src/components/LastUpdated/index.tsx Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com> Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com> --- .../src/components/LastUpdated/LastUpdated.test.tsx | 2 +- superset-frontend/src/components/LastUpdated/index.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/superset-frontend/src/components/LastUpdated/LastUpdated.test.tsx b/superset-frontend/src/components/LastUpdated/LastUpdated.test.tsx index 18014d49c..830695918 100644 --- a/superset-frontend/src/components/LastUpdated/LastUpdated.test.tsx +++ b/superset-frontend/src/components/LastUpdated/LastUpdated.test.tsx @@ -34,7 +34,7 @@ describe('LastUpdated', () => { it('renders a refresh action', () => { const mockAction = jest.fn(); wrapper = mount(); - const props = wrapper.find('[data-test="refresh"]').first().props(); + const props = wrapper.find('[aria-label="refresh"]').first().props(); if (props.onClick) { props.onClick({} as React.MouseEvent); } diff --git a/superset-frontend/src/components/LastUpdated/index.tsx b/superset-frontend/src/components/LastUpdated/index.tsx index dc5595730..1b838b503 100644 --- a/superset-frontend/src/components/LastUpdated/index.tsx +++ b/superset-frontend/src/components/LastUpdated/index.tsx @@ -19,13 +19,13 @@ import React, { useEffect, useState, FunctionComponent } from 'react'; import moment, { Moment, MomentInput } from 'moment'; import { t, styled } from '@superset-ui/core'; -import Icon from 'src/components/Icon'; +import Icons from 'src/components/Icons'; const REFRESH_INTERVAL = 60000; // every minute interface LastUpdatedProps { updatedAt: MomentInput; - update?: React.MouseEventHandler; + update?: React.MouseEventHandler; } moment.updateLocale('en', { calendar: { @@ -42,7 +42,7 @@ const TextStyles = styled.span` color: ${({ theme }) => theme.colors.grayscale.base}; `; -const Refresh = styled(Icon)` +const Refresh = styled(Icons.Refresh)` color: ${({ theme }) => theme.colors.primary.base}; width: auto; height: ${({ theme }) => theme.gridUnit * 5}px; @@ -72,7 +72,7 @@ export const LastUpdated: FunctionComponent = ({ return ( {t('Last Updated %s', timeSince.isValid() ? timeSince.calendar() : '--')} - {update && } + {update && } ); };