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>
This commit is contained in:
parent
a0179ac513
commit
076f774daf
|
|
@ -34,7 +34,7 @@ describe('LastUpdated', () => {
|
|||
it('renders a refresh action', () => {
|
||||
const mockAction = jest.fn();
|
||||
wrapper = mount(<LastUpdated updatedAt={updatedAt} update={mockAction} />);
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<SVGSVGElement>;
|
||||
update?: React.MouseEventHandler<HTMLSpanElement>;
|
||||
}
|
||||
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<LastUpdatedProps> = ({
|
|||
return (
|
||||
<TextStyles>
|
||||
{t('Last Updated %s', timeSince.isValid() ? timeSince.calendar() : '--')}
|
||||
{update && <Refresh name="refresh" onClick={update} />}
|
||||
{update && <Refresh onClick={update} />}
|
||||
</TextStyles>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue