Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

layout: add flex="noshrink" option #6067

Closed
julienpa opened this issue Dec 3, 2015 · 7 comments
Closed

layout: add flex="noshrink" option #6067

julienpa opened this issue Dec 3, 2015 · 7 comments
Assignees
Milestone

Comments

@julienpa
Copy link

julienpa commented Dec 3, 2015

I've just read this thread: #2632

And based on this specification: https://gist.github.com/ThomasBurleson/88152ec57c9133dec57a

...there is no way to make an element grow by default without shrinking when viewport's height is too small.
The only option to prevent shrinking is flex="none" but then the element won't grow.

My sample code:

<md-content layout="column">
  <div ng-style="{'background-image': 'url(' + getBannerFromTheme() + ')'}" alt="Branding banner"></div>
  <div flex layout="column" layout-align="center center" class="md-padding">
    [...]
  </div>
</md-content>

The first <div> has a fixed size and I want the second one to take the rest of the space. But when viewport height is too small, I don't want the second <div> to shrink because it breaks the design. I just want it to be hidden and accessible when scrolling, to keep the same design.
So currently I have to set flex-shrink: 0 manually.

Having something like [flex="fixed"] { flex: 1 0 auto; } or [flex="noshrink"] { flex: 1 0 auto; } would be really handy (it's the opposite of initial).

@ThomasBurleson
Copy link
Contributor

@julienpa - RE > I just want it to be hidden and accessible when scrolling, to keep the same design.
Can you not just add <div hide-xs .../>.

Meanwhile, the noshrink is a good addition.

I do not like fixed since the div can still grow... so fixed is misleading.

@ThomasBurleson ThomasBurleson modified the milestones: 1.0-rc7, 1.01 Dec 7, 2015
@ThomasBurleson ThomasBurleson changed the title [Feature request] Add flex="noshrink" option layout: add flex="noshrink" option Dec 7, 2015
@julienpa
Copy link
Author

julienpa commented Dec 7, 2015

@ThomasBurleson I can't hide it, there are important information in there (it's an offline training app). I can keep doing it manually, it's ok.
It just felt lacking for me since there are many possibilities for the 2 other flex options (grow and basis) but almost no control over shrink which is very useful sometimes.
Anyway thanks for considering it and replying!

@julienpa
Copy link
Author

julienpa commented Dec 7, 2015

I do not like fixed since the div can still grow... so fixed is misleading.

What about: flex="content" (flex is aware of the content and won't shrink it)
Or: flex="minimum" (there is a minimum size, indicating it won't shrink)

Just suggestions to keep names that have a meaning without technical flex values

@ThomasBurleson
Copy link
Contributor

@julienpa - Based on your feedback, I think noshrink is the best.

@devversion
Copy link
Member

@ThomasBurleson So should I change my PR to noshrink?

@ThomasBurleson
Copy link
Contributor

@devversion - That would be great. Thx

@julienpa
Copy link
Author

julienpa commented Dec 7, 2015

Ok for me, that would be great!
Thanks for your time

devversion added a commit to devversion/material that referenced this issue Dec 7, 2015
devversion added a commit to devversion/material that referenced this issue Dec 7, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants