Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 26, 2023
1 parent 1e9f05c commit ce3d61e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion client/src/components/ElementEditor/AddElementPopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class AddElementPopover extends Component {
}

/**
* #graphql
*
* click handler that preserves the details of what was clicked
* @param {object} elementType in the shape of types/elmementTypeType
* @returns {function}
Expand All @@ -42,6 +44,16 @@ class AddElementPopover extends Component {
};
}

/**
* #rpc
* - call add element to area endpoint (areaID, elementType, insertAfterElementID)
* - then call read blocks from area endpoint (areaID)
* - also then update the preview via jquery/entwine
*/
handleButtonOnClick(elementType) {
// todo
}

/**
* Pass toggle to parent and clear the search input
*/
Expand All @@ -66,11 +78,14 @@ class AddElementPopover extends Component {
extraClass
);

const globalUseGraphqQL = false;
const buttonOnClickHandler = globalUseGraphqQL ? this.getElementButtonClickHandler : this.handleButtonOnClick;

const buttons = elementTypes.map((elementType) => ({
content: elementType.title,
key: elementType.name,
className: classNames(elementType.icon, 'btn--icon-xl', 'element-editor-add-element__button'),
onClick: this.getElementButtonClickHandler(elementType),
onClick: buttonOnClickHandler(elementType),
}));

return (
Expand Down

0 comments on commit ce3d61e

Please sign in to comment.