diff --git a/app/soapbox/components/__mocks__/react-inlinesvg.js b/app/soapbox/components/__mocks__/react-inlinesvg.js
deleted file mode 100644
index b63d1a967..000000000
--- a/app/soapbox/components/__mocks__/react-inlinesvg.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import PropTypes from 'prop-types';
-import React from 'react';
-
-export default function InlineSVG({ src }) {
- return ;
-}
-
-InlineSVG.propTypes = {
- src: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
-};
diff --git a/app/soapbox/components/__mocks__/react-inlinesvg.tsx b/app/soapbox/components/__mocks__/react-inlinesvg.tsx
new file mode 100644
index 000000000..367ec0e33
--- /dev/null
+++ b/app/soapbox/components/__mocks__/react-inlinesvg.tsx
@@ -0,0 +1,15 @@
+import * as React from 'react';
+
+interface IInlineSVG {
+ loader?: JSX.Element,
+}
+
+const InlineSVG: React.FC = ({ loader }): JSX.Element => {
+ if (loader) {
+ return loader;
+ } else {
+ throw 'You used react-inlinesvg without a loader! This will cause jumpy loading during render.';
+ }
+};
+
+export default InlineSVG;
diff --git a/app/soapbox/components/svg_icon.js b/app/soapbox/components/svg_icon.js
index 6152f56f2..60debd082 100644
--- a/app/soapbox/components/svg_icon.js
+++ b/app/soapbox/components/svg_icon.js
@@ -25,7 +25,7 @@ export default class SvgIcon extends React.PureComponent {
className={classNames('svg-icon', className)}
{...other}
>
-
+ >} />
);
}
diff --git a/app/soapbox/components/ui/icon/__tests__/svg-icon.test.tsx b/app/soapbox/components/ui/icon/__tests__/svg-icon.test.tsx
new file mode 100644
index 000000000..a1e269dd8
--- /dev/null
+++ b/app/soapbox/components/ui/icon/__tests__/svg-icon.test.tsx
@@ -0,0 +1,15 @@
+import * as React from 'react';
+
+import { render, screen } from '../../../../jest/test-helpers';
+import SvgIcon from '../svg-icon';
+
+describe('', () => {
+ it('renders loading element with default size', () => {
+ render();
+
+ const svg = screen.getByTestId('svg-icon-loader');
+ expect(svg.getAttribute('width')).toBe('24');
+ expect(svg.getAttribute('height')).toBe('24');
+ expect(svg.getAttribute('class')).toBe('text-primary-500');
+ });
+});
diff --git a/app/soapbox/components/ui/icon/svg-icon.tsx b/app/soapbox/components/ui/icon/svg-icon.tsx
index 55abfe4da..944273933 100644
--- a/app/soapbox/components/ui/icon/svg-icon.tsx
+++ b/app/soapbox/components/ui/icon/svg-icon.tsx
@@ -9,15 +9,28 @@ interface ISvgIcon {
}
/** Renders an inline SVG with an empty frame loading state */
-const SvgIcon = ({ src, alt, size = 24, className }: ISvgIcon): JSX.Element => (
- }
- />
-);
+const SvgIcon: React.FC = ({ src, alt, size = 24, className }): JSX.Element => {
+ const loader = (
+
+ );
+
+ return (
+
+ );
+};
export default SvgIcon;