-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
[Collapse] Add orientation and horizontal support #20619
Conversation
Oh and another thing - I am not able to run tests because of following error:
|
@material-ui/core: parsed: +0.13% , gzip: +0.20% |
What OS are you using and what's the output of |
|
@oliviertassinari I see you added v5 label - when do you think we can release it?. Why not release it in some 4.x version? I would love to use it (I use it now - I copied the whole component into my source). I tried to not introduce any breaking changes. |
@darkowic We are freezing all new features from the v4 branch. |
😒 Well, then I'm waiting for v5-alpha.1 🚀 |
@darkowic You can target the |
e88077a
to
6a8f711
Compare
Updated ;) One unit tests is failing:
with |
Marked as breaking in anticipation of the removal of |
btw |
@darkowic What error are you getting? |
6a8f711
to
e8f6272
Compare
Fortunately, |
Looks like you don't have a local |
Something's off with the horizontal collapse - it slides to the right rather than collapsing to the left when |
@darkowic Fetch to upstream remote again i.e. |
@mbrookes hmm how it should work? Do we want to add some prop that defines which direction it is animated? |
It should behave the same as without |
@darkowic Could you update this PR please with the latest version of the |
Yes, I will do it together with the fix/solution for collapse animation orientation |
* BREAKING CHANGE: Remove collapsedHeight property - use collapsedSize (mui#10051)
e8f6272
to
77b487e
Compare
className={clsx(classes.wrapperInner, { | ||
[classes.horizontal]: isHorizontal, | ||
})} |
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 we use Slider's approach?
className={clsx(classes.wrapperInner, { | |
[classes.horizontal]: isHorizontal, | |
})} | |
className={classes.wrapperInner} |
@@ -41,15 +40,15 @@ export const styles = (theme) => ({ | |||
display: 'flex', | |||
width: '100%', | |||
'&$horizontal': { | |||
width: 'initial', |
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.
@@ -11,13 +11,12 @@ import { useForkRef } from '../utils'; | |||
export const styles = (theme) => ({ | |||
/* Styles applied to the container element. */ | |||
container: { | |||
position: 'relative', |
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.
Seem irrelevant
@darkowic Great work, thanks! |
Hi, I've been experimenting with this and I have found that the <Grid container>
<Collapse orientation="horizontal" in={showSidebar}>
<Grid item xs={4}>
<Sidebar />
</Grid>
</Collapse>
<Grid item xs>
<ResultList />
</Grid>
</Grid> In this case the <Slide direction="right" unmountOnExit in={showSidebar}>
...
</Slide> Then the layout behaves correctly (in that the slide component renders 'transparently', with the child Grid component sizing working as expected). Looking at the HTML. The <div class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-4" style="transform: none; transition: transform 225ms cubic-bezier(0, 0, 0.2, 1) 0ms;" /> Whereas with the <div class="MuiCollapse-container MuiCollapse-horizontal MuiCollapse-entered" style="min-width: 0px;">
<div class="MuiCollapse-wrapper MuiCollapse-horizontal">
<div class="MuiCollapse-wrapperInner MuiCollapse-horizontal">
... Is this intended? Rewriting my JSX: <Grid container>
<Collapse
timeout={3000}
className={clsx({
'MuiGrid-root': true,
'MuiGrid-item': true,
'MuiGrid-grid-xs-4': showSidebar ? true : false,
})}
orientation="horizontal"
in={showSidebar}
>
<Grid item xs={showSidebar ? 12 : 4}>
<Sidebar />
</Grid>
</Collapse>
<Grid item xs>
<ResultList />
</Grid>
</Grid> This somewhat achieves what I'm looking for but in a very jumpy, unsatisfactory way (the timout={3000} allows me to see where the problems are). I apologise if I'm misusing the Transition component in this case! If so, I would be super grateful for pointers in the correct direction. |
@zachsa Please open a new issue and fill out the template. PRs are not monitored for potential issues. |
Breaking changes
The
collapsedHeight
prop was renamedcollapsedSize
to support the horizontal direction.One thing I am not sure about - how do we handle props deprecations? The
yarn proptypes
is not adding thedeprecatedPropType
util 🤔Closes #10051