feat: Icon component (#1499)
* New icons and old strucure of OHIF ui v1 * Export icon * Removing wrong import and fixing some exports * Fixing svg loader and svg images to fullCurrent * Small fixes on docz * Remove repeated icon * Update other components to use Icon * Update platform/ui/src/components/Icon/icon.mdx Co-Authored-By: Rodrigo Antinarelli <rodrigoantinarelli@gmail.com> * Fixing callouts * Move icons to assets and fixing layout on iconButtons * Fix path of icons Co-authored-by: Danny Brown <danny.ri.brown@gmail.com> Co-authored-by: Rodrigo Antinarelli <rodrigoantinarelli@gmail.com>
This commit is contained in:
1 parent
ff90f729ab
commit
f4aea45e01
22 files changed
+370
-92
No files matched your search
@@ -0,0 +1,42 @@
|
||||
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 settings from './../../assets/icons/settings.svg';
|
||||
import sortingActiveDown from './../../assets/icons/sorting-active-down.svg';
|
||||
import sortingActiveUp from './../../assets/icons/sorting-active-up.svg';
|
||||
import sorting from './../../assets/icons/sorting.svg';
|
||||
|
||||
const ICONS = {
|
||||
active: active,
|
||||
cancel: cancel,
|
||||
'chevron-down': chevronDown,
|
||||
'chevron-right': chevronRight,
|
||||
'info-link': infoLink,
|
||||
'launch-arrow': launchArrow,
|
||||
'launch-info': launchInfo,
|
||||
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 };
|
||||
Reference in new issue
Block a user