-
Notifications
You must be signed in to change notification settings - Fork 7
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
improve split panel #852
Comments
I prefer that we use this typical react pattern:
SGTM
SGTM, as also proposed above. Would use
Maybe explain exactly what is not working in the current implementation and create a separate issue for that. |
@hamed-musallam Do you plan to work on this? Seemed like a good idea in the first place. |
Refactor the SplitPane API to be more consistent and idiomatic. Make the `open` and `size` state of the component controllable. BREAKING CHANGE: The `onToggle` prop has been renamed to `onOpenChange` and receives true when the split pane opens (previously received false). Contrary to the previous onToggle, onOpenChange is called in any circumstance when the split pane state changes, for example also when it automatically closes after it reaches the `closeThreshold` size. The original behavior of the `closed` and `size` props has changed. Their behavior were a mix of a control value prop and default value prop for internally managed state. There is now a clear separation between control props (`open` and `size`) and default value props `defaultOpen` and `defaultSize`. For example for the open state you should either: - Use `open` to control if the SplitPane is open or not, and `onOpenChange` to react to changes. Using `defaultOpen` will have no effect. - Use `defaultOpen` to set the initial value (only affects first render), with state changes being handled internally by the component. If you used `closed` with a number, use the new `closeThreshold` prop instead. Closes: #852
Great job !!!! 🎉 Thank you! Sorry, I missed your message, I had planned to work on this, but the past couple of weeks weren’t great, and then… well, the issue I opened completely vanished from my brain! 😅 |
interactionKind
PropertyCurrent issue:
When a user interacts with the splitter (e.g., clicks the "..." button), the closed property no longer controls the panel's open/close state.
Proposed solution:
Introduce an optional property called
interactionKind
, which can take one of two values:1- forced: Ensures the panel behavior is fully controlled programmatically.
2- undefined: Allows default behavior without restrictions.
closed
property:Current issue:
The closed property is overloaded with two types of values:
Boolean: Directly controls whether the panel is open or closed.
String: Represents a size threshold for automatic closing.
Proposed solution:
The closed property should only accept a boolean value for controlling the open/close state.
Introduce a new property
closeThreshold
to handle automatic closure based on panel size.onClose
Callback:Current issue:
When using the size threshold for automatic closing, there’s no way to track whether the panel is currently closed.
Proposed solution:
Add an
onClose
callback function that triggers whenever the panel is closed, regardless of whether it was closed manually or automatically.The automatic closing feature should always be active, based on the
closeThreshold
. I think we need to differentiate between two scenarios:1- User Interaction: When the user changes the panel size using the "..." button.
2- Container Resizing: If the container size causes the panel to shrink below the threshold, it should automatically close.
feat: implement right-side panels bar cheminfo/nmrium#3318
The text was updated successfully, but these errors were encountered: