aboutsummaryrefslogtreecommitdiff
path: root/src/components/chat_panel/chat_panel.vue
blob: ec379db575b3cec02c876a664247339369126a7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
  <div class="chat-panel">
    <div class="panel panel-default base01-background">
      <div class="panel-heading timeline-heading base02-background base04">
        <div class="title">
          {{$t('chat.title')}}
        </div>
      </div>
      <div class="chat-window" v-chat-scroll>
        <div class="chat-message" v-for="message in messages" :key="message.id">
          <span class="chat-avatar">
            <img :src="message.author.avatar" />
            {{message.author.username}}:
          </span>
          <span class="chat-text">
            {{message.text}}
          </span>
        </div>
      </div>
      <div class="chat-input">
        <form @submit.prevent="submit(currentMessage)">
          <input v-model="currentMessage" type="text" >
        </form>
      </div>
    </div>
  </div>
</template>

<script src="./chat_panel.js"></script>

<style lang="scss">
 .chat-window {
   max-height: 200px;
   overflow-y: auto;
   overflow-x: hidden;
 }
 .chat-message {
   padding: 0.2em 0.5em
 }
 .chat-avatar {
     img {
         height: 32px;
         width: 32px;
         border-radius: 5px;
         margin-right: 0.5em;
     }
 }
 .chat-input {
     display: flex;
     form {
         flex: auto;
         input {
             margin: 0.5em;
             width: fill-available;
         }
     }
 }
</style>