aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_note/user_note.vue
blob: 328e2350f59ffe4e1c9e2e8deda399db9f29ee4c (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<template>
  <div
    class="user-note"
  >
    <div class="heading">
      <span>{{ $t('user_card.note') }}</span>
      <div class="buttons">
        <button
          v-show="!editing"
          class="button-default btn"
          @click="startEditing"
        >
          {{ $t('user_card.edit_note') }}
        </button>
        <button
          v-show="editing"
          class="button-default btn"
          :disabled="frozen"
          @click="finalizeEditing"
        >
          {{ $t('user_card.edit_note_apply') }}
        </button>
        <button
          v-show="editing"
          class="button-default btn"
          :disabled="frozen"
          @click="cancelEditing"
        >
          {{ $t('user_card.edit_note_cancel') }}
        </button>
      </div>
    </div>
    <textarea
      v-show="editing"
      v-model="localNote"
      class="note-text"
    />
    <span
      v-show="!editing"
      class="note-text"
      :class="{ '-blank': !relationship.note }"
    >
      {{ relationship.note || $t('user_card.note_blank') }}
    </span>
  </div>
</template>

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

<style lang="scss">
@import '../../variables';

.user-note {
  display: flex;
  flex-direction: column;

  .heading {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75em;

    .btn {
      min-width: 95px;
    }

    .buttons {
      display: flex;
      flex-direction: row;
      justify-content: right;

      .btn {
        margin-left: 0.5em;
      }
    }
  }

  .note-text {
    line-height: 2;
    align-self: stretch;
  }

  .note-text.-blank {
    font-style: italic;
    color: var(--faint, $fallback--faint);
  }
}
</style>