Skip to content

Commit

Permalink
🏷️ [#445] Convert Loader component to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Mar 6, 2025
1 parent fa08946 commit f954f9d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/components/Loader.jsx → src/components/Loader.tsx
Original file line number Diff line number Diff line change
@@ -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<LoaderProps> = ({modifiers = [], withoutTranslation}) => {
const className = getBEMClassName('loading', modifiers);
return (
<div className={className} role="status">
Expand All @@ -21,9 +25,4 @@ const Loader = ({modifiers = [], withoutTranslation}) => {
);
};

Loader.propTypes = {
withoutTranslation: PropTypes.bool,
modifiers: PropTypes.arrayOf(PropTypes.oneOf(MODIFIERS)),
};

export default Loader;

0 comments on commit f954f9d

Please sign in to comment.