Skip to content

Commit

Permalink
rename draggable to movable
Browse files Browse the repository at this point in the history
  • Loading branch information
akeamc committed Jul 7, 2022
1 parent d82297a commit 1fc2a57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/djedi-json/src/core/Editable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const Editable: React.FC<{
config: ComponentConfig;
tree: NodeTreeItem;
path: string[];
draggable: boolean;
movable: boolean;
children?: ReactNode;
}> = ({ tree, config, children, path = [], draggable }) => {
}> = ({ tree, config, children, path = [], movable }) => {
// A ref to the parent. Could potentially be used to pin something or measure it to allow content-jumping.
const ref = React.useRef<HTMLSpanElement>(null);

Expand Down Expand Up @@ -115,7 +115,7 @@ const Editable: React.FC<{
>
<Component {...componentProps} />

{Boolean(over && (config.removable || config.editable || draggable)) && (
{Boolean(over && (config.removable || config.editable || movable)) && (
<span className={styles.toolbar}>
{config.editable && (
<button
Expand All @@ -137,7 +137,7 @@ const Editable: React.FC<{
<DeleteSVG fill="currentColor" />
</button>
)}
{draggable && (
{movable && (
<>
<button onClick={e => {
e.stopPropagation();
Expand Down
8 changes: 4 additions & 4 deletions packages/djedi-json/src/core/Renderer/EditorTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Editable from '../Editable';
* @returns a rendered tree of components
*/

const EditorTree: React.FC<{ tree: NodeTreeItem; path?: string[], draggable?: boolean, children?: ReactNode }> = ({ tree, path = [], draggable = false }) => {
const EditorTree: React.FC<{ tree: NodeTreeItem; path?: string[], movable?: boolean, children?: ReactNode }> = ({ tree, path = [], movable = false }) => {
const { config } = useCMS();
const { components } = config;

Expand All @@ -25,12 +25,12 @@ const EditorTree: React.FC<{ tree: NodeTreeItem; path?: string[], draggable?: bo
const { children } = tree.content;

return (
<Editable config={Config} tree={tree} path={path} draggable={draggable}>
<Editable config={Config} tree={tree} path={path} movable={movable}>
{Array.isArray(children) &&
children?.map((child, i) => {
const k = [...path, 'content', 'children', i.toString()];
const draggable = path.length === 0; // only make direct descendants of the root draggable
return <EditorTree draggable={draggable} tree={child} key={k.join('.')} path={k} />;
const movable = path.length === 0; // only make direct descendants of the root movable
return <EditorTree movable={movable} tree={child} key={k.join('.')} path={k} />;
})}
</Editable>
);
Expand Down

0 comments on commit 1fc2a57

Please sign in to comment.