refinedev / refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.
https://refine.dev
MIT License
28.59k stars 2.24k forks source link

[FEAT] ThemedSiderV2 Persist Collapsed State #6508

Open aress31 opened 2 days ago

aress31 commented 2 days ago

Is your feature request related to a problem? Please describe.

Would be nice to persist out of the box the collapsed state, or add an option to do so, maybe a "peristCollapsed" boolean. This would avoid having to write extra code for this important UX feature.

Describe alternatives you've considered

No response

Additional context

No response

Describe the thing to improve

See above.

BatuhanW commented 2 days ago

@aress31 thanks for the issue. We've discussed this one and decided to accept onSiderCollapsed function to ThemedLayoutV2 component.

Then onSiderCollapsed will be passed to ThemedLayoutContextProvider

Here, we should replace existing setSiderCollapsed with a wrapper, where we call setSiderCollapsed state action and also onSiderCollapsed coming from user.

Here is a pseudo implementation: Screenshot 2024-11-20 at 14 16 42

This will allow users to persist their collapsed state into localstorage in onSiderCollapsed method. And then users can read this from localStorage and pass initial value initialSiderCollapsed from here.

We need to do these changes in ThemedLayoutV2 component for

They all have almost exact same code, so it should be straightforward to implement.

We are open to contributions for this one.

wannabecsguy2 commented 1 day ago

Hey @BatuhanW, can I work on this?

OmkarBansod02 commented 1 day ago

Hey @BatuhanW, I am up for this.

BatuhanW commented 1 day ago

@wannabecsguy2 Assigning issue to you since you were first to ask 🚀

@OmkarBansod02 If we don't hear back from @wannabecsguy2 you can take this next. We also have other issues that you may want to work on, you can check up for grabs labelled issues ❤️