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

Commit

Permalink
fix(layout): flex="n" attrs set height for column layout, width for…
Browse files Browse the repository at this point in the history
… row

Closes #937
  • Loading branch information
ajoslin committed Dec 15, 2014
1 parent 7497348 commit d357779
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
8 changes: 2 additions & 6 deletions docs/app/css/layout-demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@
.layout-content demo-include [layout] > div {
padding: 8px;
box-shadow: 0px 2px 5px 0 rgba(0,0,0,0.26);
opacity: 0.9;
color: white;
}
.layout-content demo-include [layout] > div:nth-child(1) {
background-color: #009688;
opacity: 0.9;
color: white;
}
.layout-content demo-include [layout] > div:nth-child(2) {
background-color: #3949ab;
opacity: 0.9;
color: white;
}
.layout-content demo-include [layout] > div:nth-child(3) {
background-color: #9c27b0;
opacity: 0.9;
color: white;
}
.layout-content md-divider {
margin-top: 16px;
Expand Down
5 changes: 5 additions & 0 deletions docs/app/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ md-tabs.demo-source-tabs .active md-tab-label {
.small-demo .demo-content > div[layout-fill] {
min-height: 224px;
}
.layout-options .small-demo .demo-content > div[layout] {
min-height: auto !important;
max-height: auto !imporatnt;

This comment has been minimized.

Copy link
@aymone

aymone Jul 9, 2016

!imporatnt;

height: 128px !important;
}
.small-demo .demo-toolbar,
.small-demo .md-toolbar-tools {
min-height: 48px;
Expand Down
2 changes: 1 addition & 1 deletion docs/app/partials/layout-options.tmpl.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div ng-controller="LayoutCtrl" layout="column" layout-fill class="layout-content">
<div ng-controller="LayoutCtrl" layout="column" layout-fill class="layout-content layout-options">

<docs-demo demo-title="Responsive Layout" class="small-demo">
<demo-file name="index.html">
Expand Down
36 changes: 22 additions & 14 deletions src/core/style/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
margin: $layout-gutter-width / 2;
}

[layout-padding] + [layout-padding], /* DEPRECATED */
[layout-margin] + [layout-margin] {
margin-top: -($layout-gutter-width / 2);
}

[layout-wrap] {
flex-wrap: wrap;
}
Expand Down Expand Up @@ -69,23 +64,36 @@
flex: 1;
}

// (0-19) * 5 = 0-95%
@for $i from 0 through 19 {

// (0-20) * 5 = 0-100%
@for $i from 0 through 20 {
[#{$flexName}="#{$i * 5}"] {
flex: 0 0 #{$i * 5 + '%'};
}
[layout="row"] > [#{$flexName}="#{$i * 5}"] {
max-width: #{$i * 5 + '%'};
}
[layout="column"] > [#{$flexName}="#{$i * 5}"] {
max-height: #{$i * 5 + '%'};
}
}

[#{$flexName}="33"], [#{$flexName}="34"] {
flex: 0 0 33.33%;
max-width: 33.33%;
[layout="row"] {
> [#{$flexName}="33"], > [#{$flexName}="34"] {
max-width: 33.33%;
}
> [#{$flexName}="66"], > [#{$flexName}="67"] {
max-width: 66.66%;
}
}
[#{$flexName}="66"], [#{$flexName}="67"] {
flex: 0 0 66.66%;
max-width: 66.66%;
[layout="column"] {
> [#{$flexName}="33"], > [#{$flexName}="34"] {
max-height: 33.33%;
}
> [#{$flexName}="66"], > [#{$flexName}="67"] {
max-height: 66.66%;
}
}

}

// Flex attributes for layout children
Expand Down

0 comments on commit d357779

Please sign in to comment.