aboutsummaryrefslogtreecommitdiff
path: root/src/components/chat_panel/chat_panel.vue
blob: 50bd0017d19f8b02693b1b81f926b96244efdcab (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
59
60
61
62
63
64
<template>
  <div class="chat-panel">
    <div class="panel panel-default">
      <div class="panel-heading timeline-heading">
        <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">
@import '../../_variables.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: $fallback--avatarRadius;
    border-radius: var(--avatarRadius, $fallback--avatarRadius);
    margin-right: 0.5em;
  }
}

.chat-input {
  display: flex;
  form {
    flex: auto;
    input {
      margin: 0.5em;
      width: fill-available;
    }
  }
}
</style>