remove condition nodes

This commit is contained in:
ari committed 2021-12-16 15:47:59 -05:00
1 parent 49bb35717f
commit fff15f65ce
3 files changed
+31 -10

No files matched your search

+3 -2
View File
@@ -21,7 +21,8 @@ export const DAGCircle = ({
}: AddProps) => {
const { classes } = useCircleStyles({
size: size * 0.9,
hasOnFunction: !!onEdit || !!onAdd
hasOnFunction: !!onEdit || !!onAdd,
hasRemoveFunction: !!onRemove,
});
return <>
<foreignObject x={x} y={y} width={size} height={size}>
@@ -38,7 +39,7 @@ export const DAGCircle = ({
onClick={onAdd}
/>
: "else"}
{onRemove ? <TrashIcon className={classes.trashIcon} /> : <></>}
{onRemove ? <TrashIcon className={classes.trashIcon} onClick={onRemove} /> : <></>}
</div>
</foreignObject>
</>
+11 -8
View File
@@ -152,15 +152,16 @@ export const useNodeStyles = createAppUseStyles<{
export const useCircleStyles = createAppUseStyles<{
size: number,
hasOnFunction: boolean,
hasRemoveFunction: boolean,
}>(theme => ({
root: ({size, hasOnFunction}) => ({
root: ({size, hasOnFunction, hasRemoveFunction}) => ({
backgroundColor: Color(theme.primary).set('rgb.g', 100).hex(),
borderRadius: 500,
borderRadius: hasRemoveFunction ? 10 : 500,
height: size,
width: size,
cursor: hasOnFunction ? "pointer" : 'default',
"&:hover": {
backgroundColor: hasOnFunction ?
backgroundColor: (hasOnFunction && !hasRemoveFunction) ?
Color(theme.primary).set('rgb.g', 150).hex() :
Color(theme.primary).set('rgb.g', 100).hex(),
},
@@ -170,14 +171,16 @@ export const useCircleStyles = createAppUseStyles<{
alignItems: 'center',
}),
icon: {
padding: "15%",
"&:hover": {
borderRadius: 500,
background: Color(theme.primary).set('rgb.g', 150).hex(),
}
},
trashIcon: {
position: 'absolute',
top: 0,
left: 0,
padding: 1,
"&:hover": {
fill: theme.secondary,
borderRadius: 500,
background: Color(theme.primary).set('rgb.g', 150).hex(),
cursor: 'pointer',
}
}