Employ flexbox for auto-resizing of textareas

This change sets 'display: flex' and 'flex-direction: column' on the
main child of gr-overlay to allow for scrolling and auto resizing of
textareas when necessary, i.e. small viewports.

Bug: Issue 4833
Change-Id: I5a073822691bd766336da1058658e3bbb5f108f5
This commit is contained in:
Kasper Nilsson
2016-10-28 10:26:40 -07:00
parent 9ae418cb59
commit b3ef24e21d
3 changed files with 35 additions and 6 deletions

View File

@@ -28,6 +28,11 @@ limitations under the License.
opacity: .5; opacity: .5;
pointer-events: none; pointer-events: none;
} }
.main {
display: flex;
flex-direction: column;
width: 100%;
}
label { label {
cursor: pointer; cursor: pointer;
display: block; display: block;

View File

@@ -35,6 +35,11 @@ limitations under the License.
iron-autogrow-textarea { iron-autogrow-textarea {
padding: 0; padding: 0;
} }
.main {
display: flex;
flex-direction: column;
width: 100%;
}
.main label, .main label,
.main input[type="text"] { .main input[type="text"] {
display: block; display: block;
@@ -66,6 +71,8 @@ limitations under the License.
<iron-autogrow-textarea <iron-autogrow-textarea
id="messageInput" id="messageInput"
class="message" class="message"
rows="4"
max-rows="15"
bind-value="{{message}}"></iron-autogrow-textarea> bind-value="{{message}}"></iron-autogrow-textarea>
</div> </div>
</gr-confirm-dialog> </gr-confirm-dialog>

View File

@@ -22,11 +22,23 @@ limitations under the License.
<style> <style>
:host { :host {
display: block; display: block;
max-height: 90vh;
}
.container {
display: flex;
flex-direction: column;
max-height: 90vh;
} }
header { header {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
flex-shrink: 0;
font-weight: bold; font-weight: bold;
} }
main {
display: flex;
flex-shrink: 1;
width: 100%;
}
header, header,
main, main,
footer { footer {
@@ -34,15 +46,20 @@ limitations under the License.
} }
footer { footer {
display: flex; display: flex;
flex-shrink: 0;
justify-content: space-between; justify-content: space-between;
} }
</style> </style>
<div class="container">
<header><content select=".header"></content></header> <header><content select=".header"></content></header>
<main><content select=".main"></content></main> <main><content select=".main"></content></main>
<footer> <footer>
<gr-button primary on-tap="_handleConfirmTap">[[confirmLabel]]</gr-button> <gr-button primary on-tap="_handleConfirmTap">
[[confirmLabel]]
</gr-button>
<gr-button on-tap="_handleCancelTap">Cancel</gr-button> <gr-button on-tap="_handleCancelTap">Cancel</gr-button>
</footer> </footer>
</div>
</template> </template>
<script src="gr-confirm-dialog.js"></script> <script src="gr-confirm-dialog.js"></script>
</dom-module> </dom-module>