refactor(app): folder structure, components cleanup

This commit is contained in:
moklick
2019-10-06 19:01:02 +02:00
parent 845bae284f
commit cc2775dd78
25 changed files with 822 additions and 981 deletions
+37
View File
@@ -0,0 +1,37 @@
import React, { memo } from 'react';
import cx from 'classnames';
import { isInputNode } from '../../utils';
import store from '../../store';
export default EdgeComponent => {
const EdgeWrapper = memo((props) => {
const {
id, source, target, type,
animated, selected, onClick
} = props;
const edgeClasses = cx('react-graph__edge', { selected, animated });
const onEdgeClick = (evt) => {
if (isInputNode(evt)) {
return false;
}
store.dispatch.setSelectedElements({ id, source, target });
onClick({ id, source, target, type });
};
return (
<g
className={edgeClasses}
onClick={onEdgeClick}
>
<EdgeComponent {...props} />
</g>
);
});
EdgeWrapper.displayName = 'EdgeWrapper';
EdgeWrapper.whyDidYouRender = false;
return EdgeWrapper;
};