import * as React from 'react' import * as PropTypes from 'prop-types' import { ArrowLeft, Search, FilePlus, FileText, FolderPlus, GitBranch, Trash2, User, Menu } from 'react-feather' const DEFINED_ICONS = { 'note': FileText, 'mind-map': GitBranch, 'user': User, 'new-folder': FolderPlus, 'new-note': FilePlus, 'bin': Trash2, 'back': ArrowLeft, 'search': Search, 'menu': Menu, } const propTypes = { name: PropTypes.oneOf(Object.keys(DEFINED_ICONS)).isRequired, } type Props = PropTypes.InferProps const Icon: React.FC = ({ name }) => { const { [name as keyof typeof DEFINED_ICONS]: Component = null } = DEFINED_ICONS if (Component !== null) { return } return null } Icon.propTypes = propTypes export default Icon