Commit 1846eb66 authored by Robert Knight's avatar Robert Knight

Move `SvgIcon` component to `src/shared/components`

Move SvgIcon component to `src/shared/` in preparation for re-use in the
"annotator" part of the application.
parent f23e8c8c
......@@ -8,7 +8,7 @@ import AnnotationDocumentInfo from './annotation-document-info';
import AnnotationShareInfo from './annotation-share-info';
import AnnotationUser from './annotation-user';
import Button from './button';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
import Timestamp from './timestamp';
/**
......
import { createElement } from 'preact';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* Render information about CC licensing
......
......@@ -9,7 +9,7 @@ import { withServices } from '../util/service-context';
import Button from './button';
import useElementShouldClose from './hooks/use-element-should-close';
import ShareLinks from './share-links';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* "Popup"-style component for sharing a single annotation.
......
......@@ -4,7 +4,7 @@ import propTypes from 'prop-types';
import useStore from '../store/use-store';
import { isPrivate } from '../util/permissions';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* Render information about what group an annotation is in and
......
......@@ -2,7 +2,7 @@ import classnames from 'classnames';
import { createElement } from 'preact';
import propTypes from 'prop-types';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* A button, one of three base types depending on provided props:
......
......@@ -8,7 +8,7 @@ import { withServices } from '../util/service-context';
import VersionData from '../util/version-data';
import SidebarPanel from './sidebar-panel';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
import Tutorial from './tutorial';
import VersionInfo from './version-info';
......
......@@ -4,7 +4,7 @@ import propTypes from 'prop-types';
import { withServices } from '../util/service-context';
import Button from './button';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* Render a call-to-action to log in or sign up. This message is intended to be
......
......@@ -11,7 +11,7 @@ import {
} from '../markdown-commands';
import MarkdownView from './markdown-view';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
// Mapping of toolbar command name to key for Ctrl+<key> keyboard shortcuts.
// The shortcuts are taken from Stack Overflow's editor.
......
......@@ -5,7 +5,7 @@ import propTypes from 'prop-types';
import { onActivate } from '../util/on-activate';
import Slider from './slider';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* An item in a dropdown menu.
......
......@@ -4,7 +4,7 @@ import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import useElementShouldClose from './hooks/use-element-should-close';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
// The triangular indicator below the menu toggle button that visually links it
// to the menu content.
......
......@@ -8,7 +8,7 @@ import uiConstants from '../ui-constants';
import { withServices } from '../util/service-context';
import NewNoteBtn from './new-note-btn';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* Display name of the tab and annotation count.
......
......@@ -9,7 +9,7 @@ import { withServices } from '../util/service-context';
import Button from './button';
import ShareLinks from './share-links';
import SidebarPanel from './sidebar-panel';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* A panel for sharing the current group's annotations.
......
......@@ -3,7 +3,7 @@ import propTypes from 'prop-types';
import { withServices } from '../util/service-context';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* A single sharing link as a list item
......
......@@ -4,7 +4,7 @@ import propTypes from 'prop-types';
import useStore from '../store/use-store';
import Button from './button';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* An error message to display in the sidebar.
......
......@@ -7,7 +7,7 @@ import useStore from '../store/use-store';
import Button from './button';
import Slider from './slider';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* Base component for a sidebar panel.
......
......@@ -5,7 +5,7 @@ import propTypes from 'prop-types';
import { withServices } from '../util/service-context';
import AutocompleteList from './autocomplete-list';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
import useElementShouldClose from './hooks/use-element-should-close';
// Global counter used to create a unique id for each instance of a TagEditor
......
......@@ -5,6 +5,7 @@ import { act } from 'preact/test-utils';
import Menu from '../menu';
import { $imports } from '../menu';
import mockImportedComponents from '../../../test-util/mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('Menu', () => {
......@@ -32,10 +33,7 @@ describe('Menu', () => {
container = document.createElement('div');
document.body.appendChild(container);
$imports.$mock({
// eslint-disable-next-line react/display-name
'./svg-icon': () => <span>Fake SVG icon</span>,
});
$imports.$mock(mockImportedComponents());
});
afterEach(() => {
......
......@@ -5,7 +5,7 @@ import propTypes from 'prop-types';
import useStore from '../store/use-store';
import { withServices } from '../util/service-context';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* An individual toast message—a brief and transient success or error message.
......
......@@ -4,7 +4,7 @@ import propTypes from 'prop-types';
import isThirdPartyService from '../util/is-third-party-service';
import { withServices } from '../util/service-context';
import SvgIcon from './svg-icon';
import SvgIcon from '../../shared/components/svg-icon';
/**
* Subcomponent: an "instruction" within the tutorial step that includes an
......
......@@ -108,7 +108,7 @@ function autosave(autosaveService) {
}
// Register icons used by the sidebar app (and maybe other assets in future).
import { registerIcons } from './components/svg-icon';
import { registerIcons } from '../shared/components/svg-icon';
import iconSet from './icons';
registerIcons(iconSet);
......@@ -124,7 +124,7 @@ import SearchStatusBar from './components/search-status-bar';
import SelectionTabs from './components/selection-tabs';
import ShareAnnotationsPanel from './components/share-annotations-panel';
import SidebarContentError from './components/sidebar-content-error';
import SvgIcon from './components/svg-icon';
import SvgIcon from '../shared/components/svg-icon';
import Thread from './components/thread';
import ToastMessages from './components/toast-messages';
import TopBar from './components/top-bar';
......
......@@ -16,5 +16,5 @@ configure({ adapter: new Adapter() });
// app available in the tests. This enables validation of icon names passed to
// `SvgIcon`.
import iconSet from '../icons';
import { registerIcons } from '../components/svg-icon';
import { registerIcons } from '../../shared/components/svg-icon';
registerIcons(iconSet);
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