-
Notifications
You must be signed in to change notification settings - Fork 12
/
DynamicConfigResourceIcon.jsx
33 lines (30 loc) · 1.11 KB
/
DynamicConfigResourceIcon.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
import { Icon } from '@mui/material';
import {
List as SourceIcon, Loyalty as CollectionIcon, Person as UserIcon,
Info as InfoIcon, Home as HomeIcon, Link as MappingIcon,
AccountTreeRounded as VersionIcon, LocalOffer as ConceptIcon
} from '@mui/icons-material';
import { includes, snakeCase } from 'lodash';
const DynamicConfigResourceIcon = ({resource, index, style, icon}) => {
if(icon)
return (<Icon style={{fontSize: '20px'}}>{snakeCase(icon)}</Icon>)
if(resource === 'sources')
return (<SourceIcon style={style} />)
if(resource === 'collections')
return <CollectionIcon style={style} />
if(resource === 'users')
return <UserIcon style={style} />
if(resource === 'concepts')
return <ConceptIcon style={style} />
if(resource === 'mappings')
return <MappingIcon style={style} />
if(includes(['versions', 'history'], resource))
return <VersionIcon style={style} />
if(index === 0)
return <HomeIcon style={style} />
if(includes(['about', 'text'], resource))
return <InfoIcon style={style} />
return '';
}
export default DynamicConfigResourceIcon;