Commit b8551fbc authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Extract `LoadingSpinner`

Unmock in `ShareDialog` tests for the moment as this is a very simple
component.
parent d09ca722
import { Spinner } from '@hypothesis/frontend-shared';
/**
* Render a consistently sized and positioned loading spinner for dialog or
* tab content
*/
export default function LoadingSpinner() {
return (
<div
className="flex flex-row items-center justify-center"
data-testid="loading-spinner"
>
<Spinner size="md" />
</div>
);
}
...@@ -9,7 +9,6 @@ import { ...@@ -9,7 +9,6 @@ import {
Input, Input,
InputGroup, InputGroup,
LockIcon, LockIcon,
Spinner,
TabList, TabList,
Tab, Tab,
} from '@hypothesis/frontend-shared'; } from '@hypothesis/frontend-shared';
...@@ -24,17 +23,7 @@ import { useSidebarStore } from '../../store'; ...@@ -24,17 +23,7 @@ import { useSidebarStore } from '../../store';
import { copyText } from '../../util/copy-to-clipboard'; import { copyText } from '../../util/copy-to-clipboard';
import ShareLinks from '../ShareLinks'; import ShareLinks from '../ShareLinks';
import SidebarPanel from '../SidebarPanel'; import SidebarPanel from '../SidebarPanel';
import LoadingSpinner from './LoadingSpinner';
function LoadingSpinner() {
return (
<div
className="flex flex-row items-center justify-center"
data-testid="loading-spinner"
>
<Spinner size="md" />
</div>
);
}
/** /**
* Render a header to go above a Card, with contents in a TabList * Render a header to go above a Card, with contents in a TabList
......
...@@ -45,6 +45,8 @@ describe('ShareDialog', () => { ...@@ -45,6 +45,8 @@ describe('ShareDialog', () => {
}; };
$imports.$mock(mockImportedComponents()); $imports.$mock(mockImportedComponents());
// Don't mock this very simple component
$imports.$restore({ './LoadingSpinner': true });
$imports.$mock({ $imports.$mock({
'../../store': { useSidebarStore: () => fakeStore }, '../../store': { useSidebarStore: () => fakeStore },
'../../helpers/annotation-sharing': { '../../helpers/annotation-sharing': {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment