Skip to content

Commit 0761ef6

Browse files
committed
yey grid works
1 parent 13b228a commit 0761ef6

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ <h2>
242242

243243
<template id="windowWrapperTemplate">
244244
<div class="window-wrapper">
245-
<chat-window v-if="window.type == TYPE.CHAT" :chat="window.content"></chat-window>
245+
<chat-window v-if="window.type == TYPE.CHAT" :chat="window.content" :window="window"></chat-window>
246246
<new-conversation-form v-if="window.type == TYPE.NEWCHAT" :window="window" :form="window.content.form">
247247
</new-conversation-form>
248248
</div>

scripts/ui.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,19 @@ class UI {
182182
template: '#contactItemTemplate',
183183
methods: {
184184
open(e) {
185-
if (e.shiftKey) {
186-
this.$root.pushChat(this.contact)
185+
if (e.shiftKey) {
186+
this.$root.pushChat(this.contact);
187+
var that = this;
188+
setTimeout(function() {
189+
var all = document.querySelectorAll('.window-wrapper');
190+
var length = that.$root.openedChats.length;
191+
for (var i = 0; i < all.length; i++) {
192+
all[i].style.height = 'calc(' + (100 / Math.ceil(length / 2)) + 'vh - ' + (70 / Math.ceil(length / 2)) + 'px)';
193+
}
194+
}, 0);
195+
} else {
196+
this.$root.openChat(this.contact);
187197
};
188-
this.$root.openChat(this.contact);
189198
}
190199
},
191200
computed: {
@@ -250,6 +259,14 @@ class UI {
250259
close() {
251260
var index = that.vue.openedChats.indexOf(this.window);
252261
that.vue.openedChats.splice(index, 1);
262+
setTimeout(function() {
263+
var all = document.querySelectorAll('.window-wrapper');
264+
var length = that.vue.openedChats.length;
265+
console.log('calc(' + (100 / Math.ceil(length / 2)) + 'vh - ' + (70 / Math.ceil(length / 2)) + 'px)');
266+
for (var i = 0; i < all.length; i++) {
267+
all[i].style.height = 'calc(' + (100 / Math.ceil(length / 2)) + 'vh - ' + (70 / Math.ceil(length / 2)) + 'px)';
268+
}
269+
}, 0);
253270
},
254271
focusHandler() {
255272
that.vue.focusedChat = this;

styles/index.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ body {
260260
position: absolute;
261261
right: 16px;
262262
top: 52px;
263+
display: grid;
264+
grid-template-columns: auto auto;
263265
}
264266

265267
.window {
@@ -457,7 +459,7 @@ body {
457459
background: transparent;
458460
margin-left: 4px;
459461
padding: 0;
460-
color: #ffffff77;
462+
color: #ffffff77;
461463
}
462464

463465
.window .header .actions .button:hover {
@@ -479,7 +481,7 @@ body {
479481

480482
.window-wrapper {
481483
height: calc(100vh - 70px);
482-
transition: left 300ms ease, width 300ms ease, height 300ms ease;
484+
transition: left 300ms ease, top 300ms ease;
483485
animation: window-wrapper-open 400ms;
484486
z-index: 0;
485487
}

0 commit comments

Comments
 (0)