Skip to content
Snippets Groups Projects

feat(schema): add node detail popup when clicking nodes in schema panel

Merged Leonardo Christino requested to merge feat/DEV-35 into main
16 files
+ 326
2426
Compare changes
  • Side-by-side
  • Inline
Files
16
+ 51
0
import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
import CloseIcon from '@mui/icons-material/Close';
export const FormDiv = React.forwardRef<HTMLDivElement, PropsWithChildren<{ className?: string; hAnchor?: string; offset?: string }>>(
(props, ref) => {
return (
<div
className={'absolute opacity-100 transition-opacity group-hover:opacity-100 z-50 ' + (props.className ? props.className : '')}
ref={ref}
style={props.hAnchor === 'left' ? { left: props.offset || 0 } : { right: props.offset || '5rem' }}
>
{props.children}
</div>
);
}
);
export const FormCard = (props: PropsWithChildren<{ className?: string }>) => (
<div className={'card card-bordered bg-white rounded-none ' + (props.className ? props.className : '')}>{props.children}</div>
);
export const FormBody = ({
children,
...props
}: PropsWithChildren<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>>) => (
<form className="card-body px-0 w-72 py-5" {...props}>
{children}
</form>
);
export const FormTitle = ({ children, title, onClose }: PropsWithChildren<{ title: string; onClose: () => void }>) => (
<div className="card-title p-5 py-0 flex w-full">
<h2 className="w-full">{title}</h2>
<button className="btn btn-circle btn-sm btn-ghost" onClick={() => onClose()}>
<CloseIcon fontSize="small" />
</button>
</div>
);
export const FormHBar = () => <div className="divider m-0"></div>;
export const FormControl = ({ children }: PropsWithChildren) => <div className="form-control px-5">{children}</div>;
export const FormActions = (props: { onClose: () => void }) => (
<div className="card-actions mt-1 w-full px-5 flex flex-row">
<button
className="btn btn-secondary flex-grow"
onClick={(e) => {
e.preventDefault();
props.onClose();
}}
>
Cancel
</button>
<button className="btn btn-primary flex-grow">Apply</button>
</div>
);
Loading