basic_user_card.vue 1.88 KB
Newer Older
1
<template>
2
  <div class="user-card">
3
    <router-link :to="userProfileLink(user)">
Tae Hoon's avatar
Tae Hoon committed
4
      <UserAvatar class="avatar" @click.prevent.native="toggleUserExpanded" :src="user.profile_image_url"/>
5
    </router-link>
6
    <div class="user-card-expanded-content" v-if="userExpanded">
7 8
      <user-card-content :user="user" :switcher="false"></user-card-content>
    </div>
9
    <div class="user-card-collapsed-content" v-else>
10 11 12
      <div :title="user.name" class="user-card-user-name">
        <span v-if="user.name_html" v-html="user.name_html"></span>
        <span v-else>{{ user.name }}</span>
13
      </div>
14
      <div>
Tae Hoon's avatar
Tae Hoon committed
15
        <router-link class="user-card-screen-name" :to="userProfileLink(user)">
16 17
          @{{user.screen_name}}
        </router-link>
18
      </div>
19
      <slot></slot>
20 21 22 23 24 25 26 27 28
    </div>
  </div>
</template>

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

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

29
.user-card {
30 31 32 33 34 35 36 37 38
  display: flex;
  flex: 1 0;
  padding-top: 0.6em;
  padding-right: 1em;
  padding-bottom: 0.6em;
  padding-left: 1em;
  border-bottom: 1px solid;
  margin: 0;
  border-bottom-color: $fallback--border;
Tae Hoon's avatar
Tae Hoon committed
39
  border-bottom-color: var(--border, $fallback--border);
40

41 42 43 44
  &-collapsed-content {
    margin-left: 0.7em;
    text-align: left;
    flex: 1;
Tae Hoon's avatar
Tae Hoon committed
45
    min-width: 0;
46 47 48 49 50 51 52 53
  }

  &-user-name {
    img {
      object-fit: contain;
      height: 16px;
      width: 16px;
      vertical-align: middle;
54 55
    }
  }
56

57 58
  &-expanded-content {
    flex: 1;
59
    margin-left: 0.7em;
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
    border-radius: $fallback--panelRadius;
    border-radius: var(--panelRadius, $fallback--panelRadius);
    border-style: solid;
    border-color: $fallback--border;
    border-color: var(--border, $fallback--border);
    border-width: 1px;
    overflow: hidden;

    .panel-heading {
      background: transparent;
      flex-direction: column;
      align-items: stretch;
    }

    p {
      margin-bottom: 0;
    }
77 78 79
  }
}
</style>