💄 Site > Chat > Add design

This commit is contained in:
brunosimon
2017-09-05 00:44:13 +02:00
parent e64d3c620f
commit 4be60a01b1
7 changed files with 219 additions and 25 deletions
+13 -1
View File
@@ -7,6 +7,15 @@
height 40px height 40px
background #24263A background #24263A
.stroke
position absolute
top 0
left 0
right 0
height 1px
background #FD4141
display none
.icon .icon
position absolute position absolute
top 10px top 10px
@@ -24,4 +33,7 @@
display none display none
&.hover &.hover
display inline-block display inline-block
.stroke
display block
+1
View File
@@ -1,4 +1,5 @@
<a href="#" class="alert" @click.prevent="onAlertClick"> <a href="#" class="alert" @click.prevent="onAlertClick">
<span class="stroke"></span>
<img class="icon default" src="../../../static/svg/alert.svg" alt=""> <img class="icon default" src="../../../static/svg/alert.svg" alt="">
<img class="icon hover" src="../../../static/svg/alert-hover.svg" alt=""> <img class="icon hover" src="../../../static/svg/alert-hover.svg" alt="">
</a> </a>
+27
View File
@@ -31,6 +31,11 @@ export default
user() user()
{ {
return this.$store.state.chat.user return this.$store.state.chat.user
},
scrollbarWidth()
{
return this.$store.state.scrollbarWidth
} }
}, },
@@ -152,6 +157,9 @@ export default
// Reset question // Reset question
this.$store.commit('setQuestion', null) this.$store.commit('setQuestion', null)
// Scroll to bottom
this.scrollToBottom()
} }
} }
}, },
@@ -197,6 +205,25 @@ export default
scrollToBottom() scrollToBottom()
{ {
this.$messages.scrollTop = this.$innerMessages.offsetHeight - this.$messages.offsetHeight this.$messages.scrollTop = this.$innerMessages.offsetHeight - this.$messages.offsetHeight
},
formatMinutes(time)
{
const date = new Date(time)
let minutes = '' + date.getMinutes()
if(minutes.length === 1)
{
minutes = `0${minutes}`
}
let hours = '' + date.getHours()
if(hours.length === 1)
{
hours = `0${hours}`
}
return `${hours}:${minutes}`
} }
} }
} }
+157 -7
View File
@@ -16,6 +16,15 @@
font-size 14px font-size 14px
white-space nowrap white-space nowrap
.stroke
position absolute
top 0
left 0
right 0
height 1px
background #4BD1C5
display none
.icon .icon
margin-left 4px margin-left 4px
@@ -31,12 +40,153 @@
color #4BD1C5 color #4BD1C5
&:hover &:hover
color #4BD1C5 .stroke
display block
.user-name .content
outline none position relative
border none background #24263A
height 450px
width 300px
overflow hidden
.messages .header
height 300px position absolute
overflow-y scroll top 0
left 0
width 100%
height 40px
padding-left 14px
line-height 40px
font-size 14px
.stroke
position absolute
top 0
left 0
right 0
height 1px
background #4BD1C5
display none
.dash
position absolute
top calc(50% - 1px)
right 14px
height 2px
width 12px
background #fff
&:hover
.stroke
display block
.messages
position absolute
top 40px
left 0
right 0
height 330px
padding-top 4px
overflow-y scroll
background #393855
font-size 12px
.message
position relative
padding-left 21px
margin-bottom 10px
.stroke
position absolute
top 0px
left 10px
width 2px
bottom 2px
.message-user
padding-bottom 3px
.message-date
display inline-block
opacity 0
padding-left 4px
padding-bottom 3px
.message-file
display block
padding-bottom 3px
opacity 0.7
&:hover
opacity 1
color #4BD1C5
&:hover
.message-date
opacity 0.4
.user
position absolute
top 374px
left 0
font-size 12px
padding-left 8px
.user-label
opacity 0.7
.user-name
outline none
border none
.question
position absolute
bottom 0
right 0
padding 4px
font-size 12px
.question-file
position absolute
bottom 5px
right 22px
opacity 0.7
white-space nowrap
pointer-events none
.remove
position absolute
bottom 0
right 0
width 20px
height 20px
padding-top 4px
padding-left 3px
.icon
&.default
display block
&.hover
display none
&:hover
.icon
&.default
display none
&.hover
display block
textarea
position absolute
bottom 0
left 0
font-size 12px
width 100%
height 58px
padding-left 8px
resize none
// opacity 0.8
+19 -15
View File
@@ -1,5 +1,6 @@
<div class="chat"> <div class="chat">
<a href="#" v-show="!open" class="trigger" @click="onHeaderClick"> <a href="#" v-show="!open" class="trigger" @click="onHeaderClick">
<span class="stroke"></span>
Discussions Discussions
<img v-if="unreadCount === 0" class="icon default" src="../../../static/svg/chat-star.svg" alt=""> <img v-if="unreadCount === 0" class="icon default" src="../../../static/svg/chat-star.svg" alt="">
<img v-if="unreadCount > 0" class="icon hover" src="../../../static/svg/chat-star-hover.svg" alt=""> <img v-if="unreadCount > 0" class="icon hover" src="../../../static/svg/chat-star-hover.svg" alt="">
@@ -7,34 +8,37 @@
</a> </a>
<div class="content" v-show="open"> <div class="content" v-show="open">
<a href="#" class="header" @click="onHeaderClick"> <a href="#" class="header" @click="onHeaderClick">
<span class="stroke"></span>
<div class="dash"></div>
Discussions Discussions
</a> </a>
<div class="messages" @scroll="onMessagesScroll"> <div class="messages" :style="`right: -${scrollbarWidth}px;`" @scroll="onMessagesScroll">
<div class="inner-messages"> <div class="inner-messages">
<div class="message" v-for="message of messages" :key="message.date"> <div class="message" v-for="message of messages" :key="message.date">
<div class="date"> <div class="stroke" :style="`background: ${message.user.color};`"></div>
{{ message.time }} <span class="message-user" :style="`color: ${message.user.color};`">
</div>
<div class="user" :style="`color: ${message.user.color};`">
{{ message.user.name }} {{ message.user.name }}
</div> </span>
<a href="#" class="file" v-if="message.file && message.line" @click.prevent="onFileClick(message.file, message.version, message.line)"> <span class="message-date">
{{ formatMinutes(message.time) }}
</span>
<a href="#" class="message-file" v-if="message.file && message.line" @click.prevent="onFileClick(message.file, message.version, message.line)">
{{ message.file }}:{{ message.line }} {{ message.file }}:{{ message.line }}
</a> </a>
<div class="text" v-html="message.text.replace(/\n/g, '<br>')"></div> <div class="message-text" v-html="message.text.replace(/\n/g, '<br>')"></div>
</div> </div>
</div> </div>
</div> </div>
<div class="infos" v-if="user"> <div class="user" v-if="user">
Your nickname is <input maxlength="22" class="user-name" :style="`color: ${user.color};`" v-model="userName" @change="onUserNameChange($event)" @keydown="onUserNameKeyDown($event)"/> <span class="user-label">Your nickname is</span> <input maxlength="22" class="user-name" :style="`color: ${user.color};`" v-model="userName" @change="onUserNameChange($event)" @keydown="onUserNameKeyDown($event)"/>
</div> </div>
<textarea class="textarea" :style="`width:calc(100% + ${scrollbarWidth}px);padding-right:${scrollbarWidth}px;`" v-model="messageText" @keydown="onMessageTextKeyDown($event)" placeholder="Type you message here..."></textarea>
<div class="question" v-if="question"> <div class="question" v-if="question">
Question:
<span class="question-file">{{ question.file }}:{{ question.line }}</span> <span class="question-file">{{ question.file }}:{{ question.line }}</span>
<a href="#" class="remove" @click.prevent="onQuestionRemoveClick">x</a> <a href="#" class="remove" @click.prevent="onQuestionRemoveClick">
</div> <img class="icon default" src="../../../static/svg/cross.svg" alt="">
<div class="message"> <img class="icon hover" src="../../../static/svg/cross-hover.svg" alt="">
<textarea class="textarea" v-model="messageText" @keydown="onMessageTextKeyDown($event)"></textarea> </a>
</div> </div>
</div> </div>
</div> </div>
+1 -1
View File
@@ -4,7 +4,7 @@
<title>croix</title> <title>croix</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.599999964"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="1">
<g id="03.2.2---Questions-ouvert-click-ligne-6" transform="translate(-1299.000000, -826.000000)" fill="#4BD1C5"> <g id="03.2.2---Questions-ouvert-click-ligne-6" transform="translate(-1299.000000, -826.000000)" fill="#4BD1C5">
<g id="Question" transform="translate(1018.000000, 450.000000)"> <g id="Question" transform="translate(1018.000000, 450.000000)">
<g id="Croix" transform="translate(281.000000, 376.000000)"> <g id="Croix" transform="translate(281.000000, 376.000000)">

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

+1 -1
View File
@@ -4,7 +4,7 @@
<title>croix</title> <title>croix</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.599999964"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="1">
<g id="03.2.2---Questions-ouvert-click-ligne-6" transform="translate(-1299.000000, -826.000000)" fill="#F6F6F6"> <g id="03.2.2---Questions-ouvert-click-ligne-6" transform="translate(-1299.000000, -826.000000)" fill="#F6F6F6">
<g id="Question" transform="translate(1018.000000, 450.000000)"> <g id="Question" transform="translate(1018.000000, 450.000000)">
<g id="Croix" transform="translate(281.000000, 376.000000)"> <g id="Croix" transform="translate(281.000000, 376.000000)">

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB