-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[AppBar] waterfall behaviour #1321
Conversation
I published a demo of the Waterfall AppBar and here are updated docs for AppBar. Please review this or at least put here a comment if you like it, otherwise I think there's no reason to update this 2 months old PR and I will likely just close it. @oliviertassinari, don't you want to take a quick look here? |
Nice works 👍 |
I like this. @igorbt can you rebase? @oliviertassinari take a look too. We can merge then. |
@@ -16,26 +16,9 @@ let AppCanvas = React.createClass({ | |||
WebkitFontSmoothing: 'antialiased', | |||
}; | |||
|
|||
let newChildren = React.Children.map(this.props.children, (currentChild) => { | |||
if (!currentChild) { // If undefined, skip it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove this bloc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because AppBar itsefl takes care of it's position. There is a new prop called position.
Cool feature ! |
@igorbt still needs rebase.. |
Thanks for comments. No time for rebase this week. I'll try next week. |
@oliviertassinari This has fallen too far behind, I couldn't rebase it in a way that it would work. I think we should close this. |
Ahhh... too bad... I'd like to have a look at it, if a modified PR can fit, but I don't have time ATM. Anyone know how do I copy this branch into my local repo? |
add I tried everything! I first rebased the commit into one. the n I tried doing rebase onto master! HELL STORM OF CONFLICTS! so no luck. then I tried to rebase release by release. it did the job, but ended up with a dysfunctional AppBar -_- |
P.S. I can share my dysfunctional branch with you if you'd like to continue working on it. |
Yes please, so I can check both versions out ! Thanks |
@pandaiolo Alright, do the following:
Now you will see 3 branches on
You are welcome to submit a PR if you can get this fixed. |
Sorry for late reply, but I have good news. I rebased and also adapted docs. It's not pushed yet but I'll do that later today after a last look at the code. |
df16ebf
to
ef44b75
Compare
changed implementation for an optimized performance
ef44b75
to
42068dc
Compare
OK, I finally managed to rebase, improved a bit the feature and the docs and adapted the tests. I also updated demo page and also here you can see how this feature is used in the docs home page. @shaurya947 , @oliviertassinari, @ayhankuru, @pandaiolo, @subjectix can you please have a look? |
@igorbt, this is cool! 👍 While I like the waterfall name, I noticed the spec calls this concept flexible space. Also,
It'd be cool to support option 1 in this or a future pull request! I'd also be curious to hear how we can support differentiating these four blocks:
|
@newoga , @ayhankuru thanks! @newoga , thanks for link to the specs. I somehow missed this part of the Material Design spec and only saw this feature in the Polymer implementation (this is where I found the name "waterfall"). I wish I knew about this spec and do in "by the book" from the start. I definitely need behavior 1 for scrolling in my app, so I would like to invest some time in it. Maybe in a next iteration I could get AppBar closer to spec. |
@igorbt Thanks for taking the time to do a rebase on this. @newoga I like your proposals all the way. but this PR was long awaited, I think it's better to merge this now and add those feature in the next iteration. @oliviertassinari What do you think? |
@igorbt Really nice work 👍 👍 It's beautiful 😍 I'review the code too, and when the review is done. we'll merge this 🎉 |
</Route> | ||
<Redirect from="components" to="/components/appbar" /> | ||
<Route path="components" component={Components}> | ||
<Route path="appbar" component={AppBar} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change this back to app-bar, this breaks navigation in the components section
@@ -127,6 +159,7 @@ const AppBar = React.createClass({ | |||
showMenuIconButton: true, | |||
title: '', | |||
zDepth: 1, | |||
position: 'fixed', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using static
as the default?
Should we really introduce this breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you. this should be 'static' by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, main use case here is 'fixed', because, before, AppCanvas overrided it's position to fixed. So, putting it to 'static' would be more of a breaking change. But, of course it depends of how people are using it.
I can change it to 'static' if you still say so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm you do have a point, @oliviertassinari What do you think? maybe just put a note in the release. I guess there are more people using AppCanvas than AppBar alone.
Having a look at all the posibility suggested by the specification.
A good candidate for this role is the <AppCanvas
mode="waterfall"
waterfallMinHeight={40}
waterfallMaxHeight={400}
>
<AppBar
waterfallChildren={(height) => {
return <MyComponent />;
}}
/>
<div>
Contente text.
</div>
</AppCanvas> |
* the component) properties. Using onHeightChange, animation effects can be achieved | ||
* by altering style properties of specific DOM elements. | ||
*/ | ||
waterfall: React.PropTypes.shape({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it would be better to have a flat list of properties instead of an object.
It would be simpler to document and to implement an efficient shouldComponentUpdate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do this, but please let me know if it's the only problem left. I don't want to keep changing things and then get anyway a reject because of another bigger things.
@oliviertassinari , I agree with looking into the approach of having a parent component manage scroll state |
@oliviertassinari, reagarding the independent example, unfortunately it's not possible with waterfall current implementation to put an in place example because it is relying on position fixed. But I didn't use there docs AppBar, that's a separate AppBar that appears on top of it. It's kind of similar approach with the LeftNav component demo. |
@igorbt I think think you started something really good here and I see this as an important step to getting the docs closer to using standard material-ui framework. I certainly understand time constraints though. @oliviertassinari @subjectix I'm willing to help on this pull request to implement some of the remaining fixes, or to help out after if we decide to merge. I can also work off of @igorbt's branch. |
@newoga I definitely like this feature. But @oliviertassinari is right, this feature needs to go to the right place. It would be great if you could help on this, me and @oliviertassinari are busy with the docs, I would have helped otherwise since @igorbt seems to be very busy to continue working on this. Just the rebase was a work of magic. still wondering how he pulled it off 😨 I think if @igorbt would give you access to his branch so you could continue there, it would be ideal. 😁 |
@subjectix , it's no problem at all to give @newoga or whoever wants to work on this the access to the branch. I'm not sure how to do this but I'll find out if needed. |
@subjectix I just added @newoga as a collaborator. So it would be great if he can give us a helping hand here. |
@igorbt Thanks! I got an email confirmation earlier. I'll review the notes/feedback on this pull request and the branch in more detail later today and keep you in the loop. Thanks everyone! |
@newoga Thanks a lot for following up on it. This feature will make a huge number of people real happy, me included 😁 😁 |
@igorbt and all, I haven't forgotten about this. I decided to take some time this evening to review the branch and work with plain old css and javascript to make sure I understand exactly how feature works. Based on everyone's feedback, I'm also exploring a few different topics such as:
I feel like I've made some progress and I'm definitely still planning on getting some delivered in the near term, thanks for your patience! 😄 |
@newoga There's no hurry. this is a huge feature, take as much time as necessary. And thanks a whole bunch for working on this.
|
@igorbt I decided to combine my efforts with this PR with making the AppBar more composable in general. Your work was not in vain! It was super helpful in terms of implementing the scrolling logic. I'd love you feedback when you get a chance: http://newoga.github.io/material-ui-scrolling-techniques/ Probably one of the biggest remaining pieces is making the children also accept a function that gets passed the scroll position or some value to assist with user animations. |
@newoga demo looks awsome! I will have a closer look to the code. |
@newoga, I really like the composability and usage described in README. |
Thanks @igorbt!
This is true, to implement all the various scrolling behaviors of the spec, I realized we have to coordinate the modification of styling for multiple elements, sometimes but not always at the same scroll position.
The easiest way to extract AppBar's dependency on Thanks for the feedback @igorbt! I was going to try finish implementing the rest of the scrolling behavior before simplifying the code to make sure there's not a design flaw anywhere. I agree that the implementation is far from perfect, but I'd be curious what your thoughts are in terms of how the external API should work for modifying scrolling behavior. |
If you mean how API should be to enable user defined animations, then I would say it should be the most flexible way. I imagine that ScrollingBehavior component would accept one or more callback props that would be called when relevant scrolling events happen (like FlexibleSpace height changed, ToolBar position changed, etc). Then user can do whatever animations he likes either re-rendering by setting some variables in state, either by directly modifying the styles of some DOM elements that he has in some refs. |
A.W.E.S.O.M.E feature and discussion. And of course @igorbt's contribution in the first place. |
Let's close this for now. We're still very much invested in implementing this, but I think cleaning up our list of PRs will make us more productive. The composable |
What is the status of the waterfall/scrolling? |
Any news here? |
Implemented a type of AppBar position / behavior that basically transition AppBar from an initial height (maxHeight) to a minimum height while scrolling, with possibility of controlling transitions of AppBar children to create nice effects (check example in the docs and screens below).
I named it waterfall, because of a similarity with Polymer's paper-header-element waterfall mode.
Changed implementation of fixed position. Now AppCanvas don't set anymore position fixed on a child AppBar. Instead, AppBar should specify it's position (witch, by default is "fixed").
Also, AppBar now takes care by itself of creating a spacer div when in position fixed (or waterfall), so that there's no need of putting margins/paddings on the static contents that is below AppBar.
I needed a full-page example for demo in docs, this is why I made a new route for this.