day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
796 stars 147 forks source link

Splits should accept an atom to store the split state #177

Open Frozenlock opened 6 years ago

Frozenlock commented 6 years ago

:initial-split only accepts a double or a string. This means that every time the component is re-rendered (say with figwheel), it returns to the hard-coded value. This also prevents the user from having his preferred split saved in local storage for future uses.

Furthermore, if one uses :on-split-change to store the split value and deref it in :initial-split, it causes the panels to be re-rendered when the user changes the split.

jsa-aerial commented 5 years ago

First, thanks so much for re-com - it has been awesome for me (a non-CSS/flex wizard...)

Now on having an atom for the split state. Another thing this can be used for is 'closing' and 'opening' panels. This is the typical scenario where you have '<<' and '>>' buttons which would set the split % to 0 (or 100) and set back to initial (or previous) in one action - no sliding. Would be really nice. Any chance of this moving forward any time soon??

jsa-aerial commented 5 years ago

Actually, it looks like this is already done - split-perc ratom already holds the split percent value. So, would only need to test if user supplies a ratom instead of a value when binding split-perc.