functional editor
This commit is contained in:
1 parent
8dfbb9faa9
commit
1ea5f83590
5 files changed
+110
-65
No files matched your search
@@ -17,7 +17,10 @@ export const DAGCircle = ({
|
||||
onEdit,
|
||||
onAdd,
|
||||
}: AddProps) => {
|
||||
const { classes } = useCircleStyles({ size: size * 0.9 });
|
||||
const { classes } = useCircleStyles({
|
||||
size: size * 0.9,
|
||||
hasOnFunction: !!onEdit || !!onAdd
|
||||
});
|
||||
console.log({ onEdit })
|
||||
return <>
|
||||
<foreignObject x={x} y={y} width={size} height={size}>
|
||||
|
||||
@@ -149,15 +149,20 @@ export const useNodeStyles = createAppUseStyles<{
|
||||
}
|
||||
})
|
||||
|
||||
export const useCircleStyles = createAppUseStyles<{ size: number }>(theme => ({
|
||||
root: ({size}) => ({
|
||||
export const useCircleStyles = createAppUseStyles<{
|
||||
size: number,
|
||||
hasOnFunction: boolean,
|
||||
}>(theme => ({
|
||||
root: ({size, hasOnFunction}) => ({
|
||||
backgroundColor: Color(theme.primary).set('rgb.g', 100).hex(),
|
||||
borderRadius: 500,
|
||||
height: size,
|
||||
width: size,
|
||||
cursor: "pointer",
|
||||
cursor: hasOnFunction ? "pointer" : 'default',
|
||||
"&:hover": {
|
||||
backgroundColor: Color(theme.primary).set('rgb.g', 150).hex(),
|
||||
backgroundColor: hasOnFunction ?
|
||||
Color(theme.primary).set('rgb.g', 150).hex() :
|
||||
Color(theme.primary).set('rgb.g', 100).hex(),
|
||||
},
|
||||
fontSize: `${size * 0.4}px`,
|
||||
display: 'flex',
|
||||
|
||||
Reference in new issue
Block a user