forked from ToolJet/ToolJet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataSourceIcon.jsx
More file actions
32 lines (29 loc) · 1.4 KB
/
DataSourceIcon.jsx
File metadata and controls
32 lines (29 loc) · 1.4 KB
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
import React from 'react';
import { getSvgIcon } from '@/_helpers/appUtils';
import RunjsIcon from '@/Editor/Icons/runjs.svg';
import RunTooljetDbIcon from '@/Editor/Icons/tooljetdb.svg';
import RunpyIcon from '@/Editor/Icons/runpy.svg';
import ResponseIcon from '../../../../assets/images/icons/response.svg';
import IfIcon from '../../../../assets/images/icons/if.svg';
import LoopIcon from '../../../../assets/images/icons/loop.svg';
const DataSourceIcon = ({ source, height = 25, styles }) => {
const iconFile = source?.plugin?.iconFile?.data ?? source?.plugin?.icon_file?.data;
const Icon = () => getSvgIcon(source?.kind, height, height, iconFile, styles);
switch (source?.kind) {
case 'runjs':
return <RunjsIcon style={{ height: height, width: height, marginTop: '-3px' }} />;
case 'runpy':
return <RunpyIcon style={{ height: height, width: height, marginTop: '-3px' }} />;
case 'tooljetdb':
return <RunTooljetDbIcon style={{ height: height, width: height, marginTop: '-3px' }} />;
case 'If condition':
return <IfIcon style={{ height: height, width: height, marginTop: '-3px' }} />;
case 'loop':
return <LoopIcon style={{ height: height, width: height, marginTop: '-3px' }} />;
case 'response':
return <ResponseIcon style={{ height: height, width: height, marginTop: '-3px' }} />;
default:
return <Icon />;
}
};
export default DataSourceIcon;