Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize Handles #97

Closed
Gibbo3771 opened this issue Aug 17, 2021 · 7 comments
Closed

Customize Handles #97

Gibbo3771 opened this issue Aug 17, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@Gibbo3771
Copy link
Contributor

Gibbo3771 commented Aug 17, 2021

Is your feature request related to a problem? Please describe.
Handles can't be customized

Describe the solution you'd like
I want to customised the handles so that a custom component is rendered

Describe alternatives you've considered
I can't see anything except forking and changing it under the hood

Is there something I am missing here? I am currently exploring library options for a large re-write of a commercial application and this is one of the cleanest and well documented solutions that does exactly what we need.

@Gibbo3771 Gibbo3771 reopened this Aug 17, 2021
@aeagle aeagle added the enhancement New feature or request label Aug 20, 2021
@aeagle
Copy link
Owner

aeagle commented Aug 20, 2021

Hi @Gibbo3771. There is a similar request on #54. Out of interest, would you say the custom component you want to use for a resize handle has any element other than CSS styling? Potentially would you be able to set the resize handle size (with the handleSize prop) and then style the .spaces-resize-handle element on the page?

@Gibbo3771
Copy link
Contributor Author

Gibbo3771 commented Aug 20, 2021

I actually made a PR with what I had in mind #98.

The change would give user complete control over how the handle is rendered, including it's props. The prop would take a function that is called for every handle on the space. This function will have access to the props for that particular handle.

<LeftResizable handleRender={(props) => {
        return <div {...props}></div>
    }
>
    // content
</LeftResizable>

The above example would be the same as if you never used the handleRender prop, but you can see the possibilities since the the developer will have access to the same data the underlying API does.

@aeagle
Copy link
Owner

aeagle commented Aug 20, 2021

@Gibbo3771 That's useful and I will definitely consider it, but just so I consider all alternatives is it because you want to provide your own styled handle or is there something else you would be doing there "with full access" to the resize API?

@Gibbo3771
Copy link
Contributor Author

Gibbo3771 commented Aug 20, 2021

This mostly came from me searching for a framework for a re-write of a large commercial app, we have specific styling and dragging anchor points on our current implementation, that we want to keep. Yes I could override the CSS, but I felt exposing the API in a controlled manner would be more appropriate.

Everyone has different needs, and I guess it comes down to does this fit with your vision.

Worth noting, I am usually in favour of extending sensible defaults, rather than overriding them. That's why I am not a fan of just overriding the CSS.

@aeagle
Copy link
Owner

aeagle commented Aug 20, 2021 via email

@aeagle
Copy link
Owner

aeagle commented Nov 17, 2021

Prepping function in #103

@aeagle
Copy link
Owner

aeagle commented Nov 17, 2021

Functionality has now been released in v0.3.0

@aeagle aeagle closed this as completed Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants