ohif-viewer/platform/ui/src/components/Icon/getIcon.jsx
Gustavo André Lelis 8c6daf5395 Feat/ui v2 ohif logo svg (#1506)
* Adding new icons

* Introducing Svg component

* Adding ohif logo into header
2020-05-15 12:36:01 +01:00

47 lines
1.6 KiB
JavaScript

import React from 'react';
// Icons
import active from './../../assets/icons/active.svg';
import cancel from './../../assets/icons/cancel.svg';
import chevronDown from './../../assets/icons/chevron-down.svg';
import chevronRight from './../../assets/icons/chevron-right.svg';
import infoLink from './../../assets/icons/info-link.svg';
import launchArrow from './../../assets/icons/launch-arrow.svg';
import launchInfo from './../../assets/icons/launch-info.svg';
import logoOhifSmall from './../../assets/icons/logo-ohif-small.svg';
import notificationwarningDiamond from './../../assets/icons/notificationwarning-diamond.svg';
import settings from './../../assets/icons/settings.svg';
import sorting from './../../assets/icons/sorting.svg';
import sortingActiveDown from './../../assets/icons/sorting-active-down.svg';
import sortingActiveUp from './../../assets/icons/sorting-active-up.svg';
const ICONS = {
active: active,
cancel: cancel,
'chevron-down': chevronDown,
'chevron-right': chevronRight,
'info-link': infoLink,
'launch-arrow': launchArrow,
'launch-info': launchInfo,
'logo-ohif-small': logoOhifSmall,
'notificationwarning-diamond': notificationwarningDiamond,
settings: settings,
'sorting-active-down': sortingActiveDown,
'sorting-active-up': sortingActiveUp,
sorting: sorting,
};
/**
* Return the matching SVG Icon as a React Component.
* Results in an inlined SVG Element. If there's no match,
* return `null`
*/
export default function getIcon(key, props) {
if (!key || !ICONS[key]) {
return React.createElement('div', null, 'Missing Icon');
}
return React.createElement(ICONS[key], props);
}
export { ICONS };