Skip to content

Commit

Permalink
PLANET-7153: Follow up Wordpress 6.2 deprecations (#1042)
Browse files Browse the repository at this point in the history
* Replace position value to placement

- Replace the deprectaed isPrimary prop to variant taken from @types/wordpress__components/button/index.d.ts line 15
- Replace the deprectaed isSecondary prop to variantaken from @types/wordpress__components/button/index.d.ts line 21
- Follow up React 18: ReactDOM.hydrate is no longer supported in React 18

---------

Co-authored-by: Dan Tovbein <[email protected]>
  • Loading branch information
GP-Dan-Tovbein and dantovbein authored Aug 23, 2023
1 parent c1fd47b commit baf89cb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions assets/src/ImageBlockExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ const addExtraControls = function() {
});
updateCaptionAlignment(option.value);
}}
isPrimary={captionAlignment === option.value}
isSecondary={captionAlignment !== option.value}>
variant={captionAlignment === option.value ? 'primary' : 'secondary'}>
{ option.label }
</Button>;
})
Expand Down
2 changes: 1 addition & 1 deletion assets/src/blocks/Accordion/AccordionEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const renderEdit = ({tabs}, setAttributes, updateTabAttribute) => {
{__('Add item', 'planet4-blocks-backend')}
</Button>
<Button
isSecondary
variant="secondary"
disabled={tabs.length <= 1}
onClick={removeTab}
>
Expand Down
4 changes: 2 additions & 2 deletions assets/src/blocks/CarouselHeader/EditableBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export const EditableBackground = ({
}
</div>
<Dropdown
position="bottom left"
placement="bottom left"
className="carousel-header-editor-controls"
renderToggle={({onToggle}) => (
<Button
isPrimary
variant="primary"
icon="edit"
onClick={onToggle}
>
Expand Down
2 changes: 1 addition & 1 deletion assets/src/blocks/Submenu/SubmenuEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const renderEdit = (attributes, setAttributes) => {
{__('Add level', 'planet4-blocks-backend')}
</Button>
<Button
isSecondary
variant="secondary"
onClick={removeLevel}
disabled={attributes.levels.length <= 1}
>
Expand Down
4 changes: 3 additions & 1 deletion assets/src/functions/hydrateBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export const hydrateBlock = (blockName, Component, csrAttributes = {}) => { // e
blocks.forEach(
blockNode => {
const attributes = JSON.parse(blockNode.dataset.attributes);
hydrateRoot(blockNode, <Component {...attributes} {...csrAttributes} />);
if(blockNode.length) {
hydrateRoot(blockNode, <Component {...attributes} {...csrAttributes} />);
}
}
);
};

0 comments on commit baf89cb

Please sign in to comment.