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

feat(layout): add flex noshrink attribute to prevent shrinking #6100

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/app/partials/layout-children.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ <h3>Additional Flex Values</h3>
<td>flex="grow"</td>
<td>Will grow and shrink as needed. Starts with a size of 100%. Same as <code>flex="100"</code>.</td>
</tr>
<tr>
<td>flex="noshrink"</td>
<td>Will grow as needed, but won't shrink. Starts with a size based on it's <code>width</code> and <code>height</code> values.</td>
</tr>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the attribute here too @ThomasBurleson

</table>


Expand Down
2 changes: 1 addition & 1 deletion src/core/services/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
var SUFFIXES = /(-gt)?-(sm|md|lg)/g;
var WHITESPACE = /\s+/g;

var FLEX_OPTIONS = ['grow', 'initial', 'auto', 'none'];
var FLEX_OPTIONS = ['grow', 'initial', 'auto', 'none', 'noshrink'];
var LAYOUT_OPTIONS = ['row', 'column'];
var ALIGNMENT_MAIN_AXIS= [ "", "start", "center", "end", "stretch", "space-around", "space-between" ];
var ALIGNMENT_CROSS_AXIS= [ "", "start", "center", "end", "stretch" ];
Expand Down
1 change: 1 addition & 0 deletions src/core/services/layout/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
.#{$flexName}-initial { flex: 0 1 auto; box-sizing: border-box; }
.#{$flexName}-auto { flex: 1 1 auto; box-sizing: border-box; }
.#{$flexName}-none { flex: 0 0 auto; box-sizing: border-box; }
.#{$flexName}-noshrink { flex: 1 0 auto; box-sizing: border-box; }

// (1-20) * 5 = 0-100%
@for $i from 0 through 20 {
Expand Down