mirror of
https://github.com/Radarr/Radarr
synced 2024-12-22 07:52:34 +00:00
Convert SpinnerIcon to TypeScript
(cherry picked from commit 25d9f09a43ded9dd07c6777390fc541ca5f89eeb) Closes #10368
This commit is contained in:
parent
0f7721ef11
commit
c6feb27962
3 changed files with 24 additions and 39 deletions
|
@ -1,34 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import { icons } from 'Helpers/Props';
|
|
||||||
import Icon from './Icon';
|
|
||||||
|
|
||||||
function SpinnerIcon(props) {
|
|
||||||
const {
|
|
||||||
name,
|
|
||||||
spinningName,
|
|
||||||
isSpinning,
|
|
||||||
...otherProps
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Icon
|
|
||||||
name={isSpinning ? (spinningName || name) : name}
|
|
||||||
isSpinning={isSpinning}
|
|
||||||
{...otherProps}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
SpinnerIcon.propTypes = {
|
|
||||||
className: PropTypes.string,
|
|
||||||
name: PropTypes.object.isRequired,
|
|
||||||
spinningName: PropTypes.object.isRequired,
|
|
||||||
isSpinning: PropTypes.bool.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
SpinnerIcon.defaultProps = {
|
|
||||||
spinningName: icons.SPINNER
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SpinnerIcon;
|
|
21
frontend/src/Components/SpinnerIcon.tsx
Normal file
21
frontend/src/Components/SpinnerIcon.tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { icons } from 'Helpers/Props';
|
||||||
|
import Icon, { IconProps } from './Icon';
|
||||||
|
|
||||||
|
export interface SpinnerIconProps extends IconProps {
|
||||||
|
spinningName?: IconProps['name'];
|
||||||
|
isSpinning: Required<IconProps['isSpinning']>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SpinnerIcon({
|
||||||
|
name,
|
||||||
|
spinningName = icons.SPINNER,
|
||||||
|
...otherProps
|
||||||
|
}: SpinnerIconProps) {
|
||||||
|
return (
|
||||||
|
<Icon
|
||||||
|
name={(otherProps.isSpinning && spinningName) || name}
|
||||||
|
{...otherProps}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
//
|
//
|
||||||
// Brands
|
// Brands
|
||||||
import {
|
import { faImdb as fabImdb } from '@fortawesome/free-brands-svg-icons';
|
||||||
faImdb as fabImdb
|
|
||||||
} from '@fortawesome/free-brands-svg-icons';
|
|
||||||
//
|
//
|
||||||
// Regular
|
// Regular
|
||||||
import {
|
import {
|
||||||
|
@ -20,7 +18,7 @@ import {
|
||||||
faKeyboard as farKeyboard,
|
faKeyboard as farKeyboard,
|
||||||
faObjectGroup as farObjectGroup,
|
faObjectGroup as farObjectGroup,
|
||||||
faObjectUngroup as farObjectUngroup,
|
faObjectUngroup as farObjectUngroup,
|
||||||
faSquare as farSquare
|
faSquare as farSquare,
|
||||||
} from '@fortawesome/free-regular-svg-icons';
|
} from '@fortawesome/free-regular-svg-icons';
|
||||||
//
|
//
|
||||||
// Solid
|
// Solid
|
||||||
|
@ -118,7 +116,7 @@ import {
|
||||||
faUser as fasUser,
|
faUser as fasUser,
|
||||||
faUserPlus as fasUserPlus,
|
faUserPlus as fasUserPlus,
|
||||||
faVial as fasVial,
|
faVial as fasVial,
|
||||||
faWrench as fasWrench
|
faWrench as fasWrench,
|
||||||
} from '@fortawesome/free-solid-svg-icons';
|
} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
//
|
//
|
Loading…
Reference in a new issue