Improve mobile layout of user card

This commit is contained in:
taehoon 2019-02-26 11:00:25 -05:00
parent 1fecac9ba6
commit c5519fa587
3 changed files with 28 additions and 8 deletions

View file

@ -13,9 +13,12 @@
<span v-if="user.name_html" v-html="user.name_html"></span> <span v-if="user.name_html" v-html="user.name_html"></span>
<span v-else>{{ user.name }}</span> <span v-else>{{ user.name }}</span>
</div> </div>
<router-link :to="userProfileLink(user)"> <div>
@{{user.screen_name}} <router-link :to="userProfileLink(user)">
</router-link> @{{user.screen_name}}
</router-link>
</div>
<slot name="primary-area"></slot>
</div> </div>
<div class="user-card-secondary-area"> <div class="user-card-secondary-area">
<slot name="secondary-area"></slot> <slot name="secondary-area"></slot>
@ -49,6 +52,7 @@
margin-left: 0.7em; margin-left: 0.7em;
text-align: left; text-align: left;
flex: 1; flex: 1;
min-width: 0;
} }
&-primary-secondary-wrapper { &-primary-secondary-wrapper {
@ -59,6 +63,8 @@
&-primary-area { &-primary-area {
flex: 1; flex: 1;
margin-right: 1em;
min-width: 0;
} }
&-user-name { &-user-name {
@ -100,5 +106,15 @@
margin-bottom: 0; margin-bottom: 0;
} }
} }
@media (min-width: 320px) and (max-width: 480px) {
&-primary-secondary-wrapper {
flex-direction: column;
}
&-primary-area {
margin-right: 0;
}
}
} }
</style> </style>

View file

@ -1,5 +1,10 @@
<template> <template>
<basic-user-card :user="user"> <basic-user-card :user="user">
<template slot="primary-area">
<span class="faint" v-if="!noFollowsYou && user.follows_you">
{{ isMe ? $t('user_card.its_you') : $t('user_card.follows_you') }}
</span>
</template>
<template slot="secondary-area"> <template slot="secondary-area">
<button <button
v-if="showFollow" v-if="showFollow"
@ -27,11 +32,6 @@
</template> </template>
</button> </button>
</template> </template>
<template slot="tertiary-area">
<span class="faint" v-if="!noFollowsYou && user.follows_you">
{{ isMe ? $t('user_card.its_you') : $t('user_card.follows_you') }}
</span>
</template>
</basic-user-card> </basic-user-card>
</template> </template>

View file

@ -22,6 +22,10 @@
flex: 1 1; flex: 1 1;
max-width: 12em; max-width: 12em;
min-width: 8em; min-width: 8em;
&:last-child {
margin-right: 0;
}
} }
} }
</style> </style>