aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_finder/user_finder.vue
blob: 39d49237424d5fd5cc2e1a6071e6caccfb50418d (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
<template>
  <div>
    <div class="user-finder-container">
      <i
        v-if="loading"
        class="icon-spin4 user-finder-icon animate-spin-slow"
      />
      <a
        v-if="hidden"
        href="#"
        :title="$t('finder.find_user')"
      ><i
        class="icon-user-plus user-finder-icon"
        @click.prevent.stop="toggleHidden"
      /></a>
      <template v-else>
        <input
          id="user-finder-input"
          ref="userSearchInput"
          v-model="username"
          class="user-finder-input"
          :placeholder="$t('finder.find_user')"
          type="text"
          @keyup.enter="findUser(username)"
        >
        <button
          class="btn search-button"
          @click="findUser(username)"
        >
          <i class="icon-search" />
        </button>
        <i
          class="button-icon icon-cancel user-finder-icon"
          @click.prevent.stop="toggleHidden"
        />
      </template>
    </div>
  </div>
</template>

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

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

.user-finder-container {
  max-width: 100%;
  display: inline-flex;
  align-items: baseline;
  vertical-align: baseline;

  .user-finder-input,
  .search-button {
    height: 29px;
  }
  .user-finder-input {
    // TODO: do this properly without a rough guesstimate of 2 icons + paddings
    max-width: calc(100% - 30px - 30px - 20px);
  }

  .search-button {
    margin-left: .5em;
    margin-right: .5em;
  }
}

</style>