From f954f9db24a114e195bd843c8687447facc48a5c Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Thu, 6 Mar 2025 21:48:17 +0100 Subject: [PATCH] :label: [#445] Convert Loader component to TS --- src/components/{Loader.jsx => Loader.tsx} | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) rename src/components/{Loader.jsx => Loader.tsx} (72%) diff --git a/src/components/Loader.jsx b/src/components/Loader.tsx similarity index 72% rename from src/components/Loader.jsx rename to src/components/Loader.tsx index 1e527862b..8122f7327 100644 --- a/src/components/Loader.jsx +++ b/src/components/Loader.tsx @@ -1,11 +1,15 @@ -import PropTypes from 'prop-types'; import {FormattedMessage} from 'react-intl'; import {getBEMClassName} from 'utils'; -export const MODIFIERS = ['centered', 'only-child', 'small', 'gray']; +export const MODIFIERS = ['centered', 'only-child', 'small', 'gray'] as const; -const Loader = ({modifiers = [], withoutTranslation}) => { +export interface LoaderProps { + modifiers?: (typeof MODIFIERS)[number][]; + withoutTranslation?: boolean; +} + +const Loader: React.FC = ({modifiers = [], withoutTranslation}) => { const className = getBEMClassName('loading', modifiers); return (
@@ -21,9 +25,4 @@ const Loader = ({modifiers = [], withoutTranslation}) => { ); }; -Loader.propTypes = { - withoutTranslation: PropTypes.bool, - modifiers: PropTypes.arrayOf(PropTypes.oneOf(MODIFIERS)), -}; - export default Loader;