Skip to content

Create wrapper component around ResizableBox #10343

@chrisvanpatten

Description

@chrisvanpatten

We use the re-resizable package for resizable boxes with drag handles.

Currently it's used in core/image and core/spacer and potentially in #9416 and similar future improvements.

Because of the way it's been implemented, each block that uses it uses their own CSS classes for the spacer handles, e.g. block-library-spacer__resize-handler-bottom and block-library-image__resize-handler-bottom. That means the CSS itself is duplicated too in the final bundle.

We also have to unset a bunch of inline styles on the parent component each time we use it (see #10331).

As a consequence, it might be good to wrap ResizableBox in our own component which eliminates the CSS duplication with global resize handle classes/styles and simplifies some of the currently duplicative code (particularly the handleClasses and handleStyles props).

My main question is where this would belong… @wordpress/components, @wordpress/editor, or somewhere else entirely?

(cc @tofumatt)

Metadata

Metadata

Assignees

No one assigned

    Labels

    General InterfaceParts of the UI which don't fall neatly under other labels.[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions