Feat/ui v2 ohif logo svg (#1506)
* Adding new icons * Introducing Svg component * Adding ohif logo into header
This commit is contained in:
1 parent
a738990675
commit
8c6daf5395
12 files changed
+133
-5
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import getSvg from './getSvg';
|
||||
|
||||
const Svg = ({ name, ...otherProps }) => {
|
||||
return <React.Fragment>{getSvg(name, { ...otherProps })}</React.Fragment>;
|
||||
};
|
||||
|
||||
Svg.propTypes = {
|
||||
name: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default Svg;
|
||||
@@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
// Svgs
|
||||
import logoOhif from './../../assets/svgs/logo-ohif.svg';
|
||||
|
||||
const SVGS = {
|
||||
'logo-ohif': logoOhif,
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the matching SVG as a React Component.
|
||||
* Results in an inlined SVG Element. If there's no match,
|
||||
* return `null`
|
||||
*/
|
||||
export default function getSvg(key, props) {
|
||||
if (!key || !SVGS[key]) {
|
||||
return React.createElement('div', null, 'Missing SVG');
|
||||
}
|
||||
|
||||
return React.createElement(SVGS[key], props);
|
||||
}
|
||||
|
||||
export { SVGS };
|
||||
@@ -0,0 +1,2 @@
|
||||
import Svg from './Svg';
|
||||
export default Svg;
|
||||
Reference in new issue
Block a user