aboutsummaryrefslogtreecommitdiff
path: root/src/components/follow_card/follow_card.vue
blob: 94e2836fcc495267a57218864bf15485eb8cb5ff (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
<template>
  <basic-user-card :user="user">
    <div class="follow-card-content-container">
      <span class="faint" v-if="!noFollowsYou && user.follows_you">
        {{ isMe ? $t('user_card.its_you') : $t('user_card.follows_you') }}
      </span>
      <template v-if="!loggedIn">
        <div class="follow-card-follow-button" v-if="!user.following">
          <RemoteFollow :user="user" />
        </div>
      </template>
      <template v-else>
        <button
          v-if="!user.following"
          class="btn btn-default follow-card-follow-button"
          @click="followUser"
          :disabled="inProgress"
          :title="requestSent ? $t('user_card.follow_again') : ''"
        >
          <template v-if="inProgress">
            {{ $t('user_card.follow_progress') }}
          </template>
          <template v-else-if="requestSent">
            {{ $t('user_card.follow_sent') }}
          </template>
          <template v-else>
            {{ $t('user_card.follow') }}
          </template>
        </button>
        <button v-else class="btn btn-default follow-card-follow-button pressed" @click="unfollowUser" :disabled="inProgress">
          <template v-if="inProgress">
            {{ $t('user_card.follow_progress') }}
          </template>
          <template v-else>
            {{ $t('user_card.follow_unfollow') }}
          </template>
        </button>
      </template>
    </div>
  </basic-user-card>
</template>

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

<style lang="scss">
.follow-card {
  &-content-container {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
    line-height: 1.5em;
  }

  &-follow-button {
    margin-top: 0.5em;
    margin-left: auto;
    width: 10em;
  }
}
</style>