popover controls for user-card

This commit is contained in:
Henry Jameson 2022-06-16 17:06:16 +03:00
parent d84cda7009
commit 60571685c2
4 changed files with 81 additions and 24 deletions

View File

@ -14,7 +14,9 @@ import {
faRss, faRss,
faSearchPlus, faSearchPlus,
faExternalLinkAlt, faExternalLinkAlt,
faEdit faEdit,
faTimes,
faExpandAlt
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
library.add( library.add(
@ -22,12 +24,21 @@ library.add(
faBell, faBell,
faSearchPlus, faSearchPlus,
faExternalLinkAlt, faExternalLinkAlt,
faEdit faEdit,
faTimes,
faExpandAlt
) )
export default { export default {
props: [ props: [
'userId', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered', 'allowZoomingAvatar' 'userId',
'switcher',
'selected',
'hideBio',
'rounded',
'bordered',
'allowZoomingAvatar',
'onClose'
], ],
data () { data () {
return { return {
@ -47,9 +58,10 @@ export default {
}, },
classes () { classes () {
return [{ return [{
'user-card-rounded-t': this.rounded === 'top', // set border-top-left-radius and border-top-right-radius '-rounded-t': this.rounded === 'top', // set border-top-left-radius and border-top-right-radius
'user-card-rounded': this.rounded === true, // set border-radius for all sides '-rounded': this.rounded === true, // set border-radius for all sides
'user-card-bordered': this.bordered === true // set border for all sides '-bordered': this.bordered === true, // set border for all sides
'-popover': !!this.onClose // set popover rounding
}] }]
}, },
style () { style () {

View File

@ -42,8 +42,10 @@
mask-composite: exclude; mask-composite: exclude;
background-size: cover; background-size: cover;
mask-size: 100% 60%; mask-size: 100% 60%;
border-top-left-radius: calc(var(--panelRadius) - 1px); border-top-left-radius: calc(var(--__roundnessTop, --panelRadius) - 1px);
border-top-right-radius: calc(var(--panelRadius) - 1px); border-top-right-radius: calc(var(--__roundnessTop, --panelRadius) - 1px);
border-bottom-left-radius: calc(var(--__roundnessBottom, --panelRadius) - 1px);
border-bottom-right-radius: calc(var(--__roundnessBottom, --panelRadius) - 1px);
background-color: var(--profileBg); background-color: var(--profileBg);
z-index: -2; z-index: -2;
@ -72,21 +74,33 @@
} }
} }
// Modifiers &.-rounded-t {
&-rounded-t {
border-top-left-radius: $fallback--panelRadius; border-top-left-radius: $fallback--panelRadius;
border-top-left-radius: var(--panelRadius, $fallback--panelRadius); border-top-left-radius: var(--panelRadius, $fallback--panelRadius);
border-top-right-radius: $fallback--panelRadius; border-top-right-radius: $fallback--panelRadius;
border-top-right-radius: var(--panelRadius, $fallback--panelRadius); border-top-right-radius: var(--panelRadius, $fallback--panelRadius);
--__roundnessTop: var(--panelRadius);
--__roundnessBottom: 0;
} }
&-rounded { &.-rounded {
border-radius: $fallback--panelRadius; border-radius: $fallback--panelRadius;
border-radius: var(--panelRadius, $fallback--panelRadius); border-radius: var(--panelRadius, $fallback--panelRadius);
--__roundnessTop: var(--panelRadius);
--__roundnessBottom: var(--panelRadius);
} }
&-bordered { &.-popover {
border-radius: $fallback--tooltipRadius;
border-radius: var(--tooltipRadius, $fallback--tooltipRadius);
--__roundnessTop: var(--tooltipRadius);
--__roundnessBottom: var(--tooltipRadius);
}
&.-bordered {
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
border-color: $fallback--border; border-color: $fallback--border;
@ -99,6 +113,15 @@
color: var(--lightText, $fallback--lightText); color: var(--lightText, $fallback--lightText);
padding: 0 26px; padding: 0 26px;
a {
color: $fallback--lightText;
color: var(--lightText, $fallback--lightText);
&:hover {
color: var(--icon);
}
}
.container { .container {
min-width: 0; min-width: 0;
padding: 16px 0 6px; padding: 16px 0 6px;
@ -206,8 +229,6 @@
flex: 0 1 auto; flex: 0 1 auto;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
color: $fallback--lightText;
color: var(--lightText, $fallback--lightText);
} }
.dailyAvg { .dailyAvg {

View File

@ -8,7 +8,7 @@
:style="style" :style="style"
class="background-image" class="background-image"
/> />
<div class="panel-heading -flexible-height"> <div :class="onClose ? '' : panel-heading -flexible-height">
<div class="user-info"> <div class="user-info">
<div class="container"> <div class="container">
<a <a
@ -38,12 +38,16 @@
</router-link> </router-link>
<div class="user-summary"> <div class="user-summary">
<div class="top-line"> <div class="top-line">
<RichContent <router-link
:title="user.name" :to="userProfileLink(user)"
class="user-name" class="user-name"
:html="user.name" >
:emoji="user.emoji" <RichContent
/> :title="user.name"
:html="user.name"
:emoji="user.emoji"
/>
</router-link>
<button <button
v-if="!isOtherUser && user.is_local" v-if="!isOtherUser && user.is_local"
class="button-unstyled edit-profile-button" class="button-unstyled edit-profile-button"
@ -72,6 +76,27 @@
:user="user" :user="user"
:relationship="relationship" :relationship="relationship"
/> />
<router-link
v-if="onClose"
:to="userProfileLink(user)"
class="button-unstyled external-link-button"
@click="onClose"
>
<FAIcon
class="icon"
icon="expand-alt"
/>
</router-link>
<button
v-if="onClose"
class="button-unstyled external-link-button"
@click="onClose"
>
<FAIcon
class="icon"
icon="times"
/>
</button>
</div> </div>
<div class="bottom-line"> <div class="bottom-line">
<router-link <router-link

View File

@ -9,14 +9,13 @@
<template v-slot:trigger> <template v-slot:trigger>
<slot /> <slot />
</template> </template>
<template v-slot:content> <template v-slot:content={close}>
<UserCard <UserCard
class="user-popover" class="user-popover"
:user-id="userId" :user-id="userId"
:hide-bio="true" :hide-bio="true"
:bordered="false"
:allow-zooming-avatar="true" :allow-zooming-avatar="true"
:rounded="true" :onClose="close"
/> />
</template> </template>
</Popover> </Popover>