changed chatroom css

This commit is contained in:
Beatrice Olivera 2018-09-06 12:45:57 +01:00
parent ec6cc273de
commit d1a245cdbf
3 changed files with 68 additions and 26 deletions

View File

@ -1,19 +1,27 @@
.messages-container-container { .messages-container-container {
background-color: $light-gray; background-color: $card-background;
width: 100%; width: 100%;
height: 100vh; height: 100vh;
position: relative; position: relative;
margin-left: 15px;
display: flex;
justify-content: center;
align-items: center;
.chat { .chat {
position: absolute; position: absolute;
bottom: 0px; bottom: 100px;
width: 90%;
} }
} }
#messages-container { #messages-container {
overflow: scroll; overflow: scroll;
overflow-x: hidden; overflow-x: hidden;
height: 95%; height: 81%;
padding: 10px; padding: 38px;
width: 90%;
border-radius: 15px;
background-color: $light-gray;
} }
select:not([multiple]) { select:not([multiple]) {
@ -33,6 +41,7 @@ select:not([multiple]) {
.avatar-sm { .avatar-sm {
width: 35px; width: 35px;
height: 35px; height: 35px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5)
} }
.messageDiv { .messageDiv {
@ -46,9 +55,9 @@ select:not([multiple]) {
padding-bottom: 2px; padding-bottom: 2px;
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
background-color: #d4d5d6; background-color: #f9bab3;
color: $navbar-background; color: $navbar-background;
border-radius: 2px; border-radius: 10px;
} }
&.right { &.right {
@ -64,3 +73,31 @@ select:not([multiple]) {
.margin-left { .margin-left {
margin-left: 10px; margin-left: 10px;
} }
.text-center {
text-align: center;
}
.hover-notice {
display: flex;
justify-content: center;
}
.input-transparent {
background-color: transparent;
border: none;
box-shadow: none;
&:focus {
box-shadow: none;
}
}
.send-button {
background: none;
border: none;
box-shadow: none;
color: gray;
&:focus {
box-shadow: none;
}
}

View File

@ -127,23 +127,23 @@ hangUpIcon.addEventListener('click', event => {
// }) // })
// }) // })
const originalBtn = document.getElementById('original-btn') // const originalBtn = document.getElementById('original-btn')
originalBtn.addEventListener('click', event => { // originalBtn.addEventListener('click', event => {
originalBtn.classList.toggle('original') // originalBtn.classList.toggle('original')
const allMessages = document.querySelectorAll('.messageDiv:not(.right) > p') // const allMessages = document.querySelectorAll('.messageDiv:not(.right) > p')
if (originalBtn.classList.contains('original')) { // if (originalBtn.classList.contains('original')) {
originalBtn.innerText = "Show Original" // originalBtn.innerText = "Show Original"
allMessages.forEach(message => { // allMessages.forEach(message => {
message.innerText = message.dataset.translated // message.innerText = message.dataset.translated
}) // })
} else { // } else {
originalBtn.innerText = "Show Translated" // originalBtn.innerText = "Show Translated"
allMessages.forEach(message => { // allMessages.forEach(message => {
message.innerText = message.dataset.original // message.innerText = message.dataset.original
}) // })
} // }
}) // })
const sendBtn = document.getElementById('send-btn') const sendBtn = document.getElementById('send-btn')
sendBtn.addEventListener('click', event => { sendBtn.addEventListener('click', event => {

View File

@ -20,6 +20,9 @@
<div class="col-xs-12 col-sm-6 col-lg-4 no-padding"> <div class="col-xs-12 col-sm-6 col-lg-4 no-padding">
<div class="messages-container-container"> <div class="messages-container-container">
<div id="messages-container"> <div id="messages-container">
<div class="hover-notice">
<span class="text-center"><small>Hover to see the original message</small></span>
</div>
</div> </div>
<div class="chat"> <div class="chat">
<div class="input-group"> <div class="input-group">
@ -29,13 +32,15 @@
<% end %> <% end %>
</select> </select>
<span class="input-group-addon" style="width:0px; padding-left:0px; padding-right:0px; border:none;"></span> <span class="input-group-addon" style="width:0px; padding-left:0px; padding-right:0px; border:none;"></span>
<input type="text" class="form-control" name="chat-input" id="chat-input" value=""> <input type="text" class="form-control input-transparent" name="chat-input" id="chat-input" value="" placeholder="Type something...">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-primary form-control" id="send-btn" type="submit" remote: true>Send</button> <button class="form-control send-button" id="send-btn" type="submit" remote: true>
<i class="fas fa-paper-plane"></i>
</button>
</span> </span>
<span class="input-group-btn"> <!-- <span class="input-group-btn">
<button class="btn btn-danger form-control" id="original-btn" type="submit" remote: true>Show Original</button> <button class="btn btn-danger form-control" id="original-btn" type="submit" remote: true>Show Original</button>
</span> </span> -->
</div> </div>
</div> </div>
</div> </div>