mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Follow @alina-beck's PR review suggestions
- Update styling - Avoid nested tags - Rename components with two names - Add story - Co-authored-by: Alina Beck <alina.beck@mail.com>
This commit is contained in:
parent
5c7a6ace08
commit
fdf00fc0c6
@ -254,8 +254,7 @@ $size-width-paginate: 100px;
|
|||||||
|
|
||||||
$size-avatar-small: 34px;
|
$size-avatar-small: 34px;
|
||||||
$size-avatar-base: 44px;
|
$size-avatar-base: 44px;
|
||||||
$size-avatar-large: 64px;
|
$size-avatar-large: 114px;
|
||||||
$size-avatar-x-large: 114px;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tokens Size Buttons
|
* @tokens Size Buttons
|
||||||
@ -316,6 +315,7 @@ $z-index-dropdown: 8888;
|
|||||||
$z-index-page-submenu: 2500;
|
$z-index-page-submenu: 2500;
|
||||||
$z-index-page-header: 2000;
|
$z-index-page-header: 2000;
|
||||||
$z-index-page-sidebar: 1500;
|
$z-index-page-sidebar: 1500;
|
||||||
|
$z-index-hc-post-card-link: 5;
|
||||||
$z-index-sticky: 100;
|
$z-index-sticky: 100;
|
||||||
$z-index-post-card-link: 5;
|
$z-index-post-card-link: 5;
|
||||||
|
|
||||||
|
|||||||
@ -12,13 +12,13 @@
|
|||||||
<div v-else :class="{ comment: true, 'disabled-content': comment.deleted || comment.disabled }">
|
<div v-else :class="{ comment: true, 'disabled-content': comment.deleted || comment.disabled }">
|
||||||
<ds-card :id="anchor" :class="{ 'comment--target': isTarget }">
|
<ds-card :id="anchor" :class="{ 'comment--target': isTarget }">
|
||||||
<ds-space margin-bottom="small" margin-top="small">
|
<ds-space margin-bottom="small" margin-top="small">
|
||||||
<hc-user :user="author" :date-time="comment.createdAt">
|
<user-teaser :user="author" :date-time="comment.createdAt">
|
||||||
<template v-slot:dateTime>
|
<template v-slot:dateTime>
|
||||||
<ds-text v-if="comment.createdAt !== comment.updatedAt">
|
<ds-text v-if="comment.createdAt !== comment.updatedAt">
|
||||||
({{ $t('comment.edited') }})
|
({{ $t('comment.edited') }})
|
||||||
</ds-text>
|
</ds-text>
|
||||||
</template>
|
</template>
|
||||||
</hc-user>
|
</user-teaser>
|
||||||
<client-only>
|
<client-only>
|
||||||
<content-menu
|
<content-menu
|
||||||
v-show="!openEditCommentMenu"
|
v-show="!openEditCommentMenu"
|
||||||
@ -61,7 +61,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import { COMMENT_MAX_UNTRUNCATED_LENGTH, COMMENT_TRUNCATE_TO_LENGTH } from '~/constants/comment'
|
import { COMMENT_MAX_UNTRUNCATED_LENGTH, COMMENT_TRUNCATE_TO_LENGTH } from '~/constants/comment'
|
||||||
import HcUser from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
import ContentMenu from '~/components/ContentMenu/ContentMenu'
|
import ContentMenu from '~/components/ContentMenu/ContentMenu'
|
||||||
import ContentViewer from '~/components/Editor/ContentViewer'
|
import ContentViewer from '~/components/Editor/ContentViewer'
|
||||||
import HcCommentForm from '~/components/CommentForm/CommentForm'
|
import HcCommentForm from '~/components/CommentForm/CommentForm'
|
||||||
@ -82,7 +82,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
HcUser,
|
UserTeaser,
|
||||||
ContentMenu,
|
ContentMenu,
|
||||||
ContentViewer,
|
ContentViewer,
|
||||||
HcCommentForm,
|
HcCommentForm,
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<ds-space />
|
<ds-space />
|
||||||
<client-only>
|
<client-only>
|
||||||
<hc-user :user="currentUser" :trunc="35" />
|
<user-teaser :user="currentUser" :trunc="35" />
|
||||||
</client-only>
|
</client-only>
|
||||||
<ds-space />
|
<ds-space />
|
||||||
<ds-input
|
<ds-input
|
||||||
@ -122,14 +122,14 @@ import locales from '~/locales'
|
|||||||
import PostMutations from '~/graphql/PostMutations.js'
|
import PostMutations from '~/graphql/PostMutations.js'
|
||||||
import HcCategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect'
|
import HcCategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect'
|
||||||
import HcTeaserImage from '~/components/TeaserImage/TeaserImage'
|
import HcTeaserImage from '~/components/TeaserImage/TeaserImage'
|
||||||
import HcUser from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
HcEditor,
|
HcEditor,
|
||||||
HcCategoriesSelect,
|
HcCategoriesSelect,
|
||||||
HcTeaserImage,
|
HcTeaserImage,
|
||||||
HcUser,
|
UserTeaser,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
contribution: { type: Object, default: () => {} },
|
contribution: { type: Object, default: () => {} },
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<ds-space :class="{ read: notification.read, notification: true }" margin-bottom="x-small">
|
<ds-space :class="{ read: notification.read, notification: true }" margin-bottom="x-small">
|
||||||
<client-only>
|
<client-only>
|
||||||
<ds-space margin-bottom="x-small">
|
<ds-space margin-bottom="x-small">
|
||||||
<hc-user :user="from.author" :date-time="from.createdAt" :trunc="35" />
|
<user-teaser :user="from.author" :date-time="from.createdAt" :trunc="35" />
|
||||||
</ds-space>
|
</ds-space>
|
||||||
<ds-text class="reason-text-for-test" color="soft">
|
<ds-text class="reason-text-for-test" color="soft">
|
||||||
{{ $t(`notifications.reason.${notification.reason}`) }}
|
{{ $t(`notifications.reason.${notification.reason}`) }}
|
||||||
@ -35,12 +35,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HcUser from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Notification',
|
name: 'Notification',
|
||||||
components: {
|
components: {
|
||||||
HcUser,
|
UserTeaser,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
notification: {
|
notification: {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { action } from '@storybook/addon-actions'
|
|||||||
import NotificationsTable from '~/components/NotificationsTable/NotificationsTable'
|
import NotificationsTable from '~/components/NotificationsTable/NotificationsTable'
|
||||||
import helpers from '~/storybook/helpers'
|
import helpers from '~/storybook/helpers'
|
||||||
import { post } from '~/components/PostCard/PostCard.story.js'
|
import { post } from '~/components/PostCard/PostCard.story.js'
|
||||||
import { user } from '~/components/User/User.story.js'
|
import { user } from '~/components/UserTeaser/UserTeaser.story.js'
|
||||||
|
|
||||||
helpers.init()
|
helpers.init()
|
||||||
export const notifications = [
|
export const notifications = [
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
<template #user="scope">
|
<template #user="scope">
|
||||||
<ds-space margin-bottom="base">
|
<ds-space margin-bottom="base">
|
||||||
<client-only>
|
<client-only>
|
||||||
<hc-user
|
<user-teaser
|
||||||
:user="scope.row.from.author"
|
:user="scope.row.from.author"
|
||||||
:date-time="scope.row.from.createdAt"
|
:date-time="scope.row.from.createdAt"
|
||||||
:trunc="35"
|
:trunc="35"
|
||||||
@ -50,12 +50,12 @@
|
|||||||
<hc-empty v-else icon="alert" :message="$t('notifications.empty')" />
|
<hc-empty v-else icon="alert" :message="$t('notifications.empty')" />
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import HcUser from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
import HcEmpty from '~/components/Empty/Empty'
|
import HcEmpty from '~/components/Empty/Empty'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
HcUser,
|
UserTeaser,
|
||||||
HcEmpty,
|
HcEmpty,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { storiesOf } from '@storybook/vue'
|
import { storiesOf } from '@storybook/vue'
|
||||||
import { withA11y } from '@storybook/addon-a11y'
|
import { withA11y } from '@storybook/addon-a11y'
|
||||||
import HcPostCard from './PostCard.vue'
|
import HcPostCard from './HcPostCard.vue'
|
||||||
import helpers from '~/storybook/helpers'
|
import helpers from '~/storybook/helpers'
|
||||||
|
|
||||||
helpers.init()
|
helpers.init()
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
:lang="post.language"
|
:lang="post.language"
|
||||||
:image="post.image | proxyApiUrl"
|
:image="post.image | proxyApiUrl"
|
||||||
:class="{
|
:class="{
|
||||||
'post-card': true,
|
'hc-post-card': true,
|
||||||
'disabled-content': post.disabled,
|
'disabled-content': post.disabled,
|
||||||
'--pinned': isPinned,
|
'--pinned': isPinned,
|
||||||
'--blur-image': post.imageBlurred,
|
'--blur-image': post.imageBlurred,
|
||||||
@ -20,7 +20,7 @@
|
|||||||
<!-- Username, Image & Date of Post -->
|
<!-- Username, Image & Date of Post -->
|
||||||
<div class="user-wrapper">
|
<div class="user-wrapper">
|
||||||
<client-only>
|
<client-only>
|
||||||
<hc-user :user="post.author" :trunc="35" :date-time="post.createdAt" />
|
<user-teaser :user="post.author" :trunc="35" :date-time="post.createdAt" />
|
||||||
</client-only>
|
</client-only>
|
||||||
<hc-ribbon v-if="isPinned" class="ribbon--pinned" :text="$t('post.pinned')" />
|
<hc-ribbon v-if="isPinned" class="ribbon--pinned" :text="$t('post.pinned')" />
|
||||||
<hc-ribbon v-else :text="$t('post.name')" />
|
<hc-ribbon v-else :text="$t('post.name')" />
|
||||||
@ -78,7 +78,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HcUser from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
import ContentMenu from '~/components/ContentMenu/ContentMenu'
|
import ContentMenu from '~/components/ContentMenu/ContentMenu'
|
||||||
import HcCategory from '~/components/Category'
|
import HcCategory from '~/components/Category'
|
||||||
import HcRibbon from '~/components/Ribbon'
|
import HcRibbon from '~/components/Ribbon'
|
||||||
@ -89,7 +89,7 @@ import { postMenuModalsData, deletePostMutation } from '~/components/utils/PostH
|
|||||||
export default {
|
export default {
|
||||||
name: 'HcPostCard',
|
name: 'HcPostCard',
|
||||||
components: {
|
components: {
|
||||||
HcUser,
|
UserTeaser,
|
||||||
HcCategory,
|
HcCategory,
|
||||||
HcRibbon,
|
HcRibbon,
|
||||||
ContentMenu,
|
ContentMenu,
|
||||||
@ -157,7 +157,7 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.post-card {
|
.hc-post-card {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
@ -190,7 +190,7 @@ export default {
|
|||||||
margin-top: $space-large;
|
margin-top: $space-large;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* workaround to avoid jumping layout when hc-user is rendered */
|
/* workaround to avoid jumping layout when user-teaser is rendered */
|
||||||
.user-wrapper {
|
.user-wrapper {
|
||||||
height: 36px;
|
height: 36px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { storiesOf } from '@storybook/vue'
|
import { storiesOf } from '@storybook/vue'
|
||||||
import { withA11y } from '@storybook/addon-a11y'
|
import { withA11y } from '@storybook/addon-a11y'
|
||||||
import User from '~/components/User/User.vue'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser.vue'
|
||||||
import helpers from '~/storybook/helpers'
|
import helpers from '~/storybook/helpers'
|
||||||
|
|
||||||
helpers.init()
|
helpers.init()
|
||||||
@ -53,25 +53,25 @@ export const user = {
|
|||||||
socialMedia: [],
|
socialMedia: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
storiesOf('User', module)
|
storiesOf('UserTeaser', module)
|
||||||
.addDecorator(withA11y)
|
.addDecorator(withA11y)
|
||||||
.addDecorator(helpers.layout)
|
.addDecorator(helpers.layout)
|
||||||
.add('available', () => ({
|
.add('available', () => ({
|
||||||
components: { User },
|
components: { UserTeaser },
|
||||||
store: helpers.store,
|
store: helpers.store,
|
||||||
data: () => ({
|
data: () => ({
|
||||||
user,
|
user,
|
||||||
}),
|
}),
|
||||||
template: '<user :user="user" :trunc="35" :date-time="new Date()" />',
|
template: '<user-teaser :user="user" :trunc="35" :date-time="new Date()" />',
|
||||||
}))
|
}))
|
||||||
.add('has edited something', () => ({
|
.add('has edited something', () => ({
|
||||||
components: { User },
|
components: { UserTeaser },
|
||||||
store: helpers.store,
|
store: helpers.store,
|
||||||
data: () => ({
|
data: () => ({
|
||||||
user,
|
user,
|
||||||
}),
|
}),
|
||||||
template: `
|
template: `
|
||||||
<user :user="user" :trunc="35" :date-time="new Date()">
|
<user-teaser :user="user" :trunc="35" :date-time="new Date()">
|
||||||
<template v-slot:dateTime>
|
<template v-slot:dateTime>
|
||||||
- HEY! I'm edited
|
- HEY! I'm edited
|
||||||
</template>
|
</template>
|
||||||
@ -79,10 +79,10 @@ storiesOf('User', module)
|
|||||||
`,
|
`,
|
||||||
}))
|
}))
|
||||||
.add('anonymous', () => ({
|
.add('anonymous', () => ({
|
||||||
components: { User },
|
components: { UserTeaser },
|
||||||
store: helpers.store,
|
store: helpers.store,
|
||||||
data: () => ({
|
data: () => ({
|
||||||
user: null,
|
user: null,
|
||||||
}),
|
}),
|
||||||
template: '<user :user="user" :trunc="35" :date-time="new Date()" />',
|
template: '<user-teaser :user="user" :trunc="35" :date-time="new Date()" />',
|
||||||
}))
|
}))
|
||||||
@ -1,26 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="user" v-if="displayAnonymous">
|
<div class="user-teaser" v-if="displayAnonymous">
|
||||||
<user-avatar v-if="showAvatar" />
|
<user-avatar v-if="showAvatar" />
|
||||||
<div>
|
<span class="username">{{ $t('profile.userAnonym') }}</span>
|
||||||
<b class="username">{{ $t('profile.userAnonym') }}</b>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<dropdown v-else :class="{ 'disabled-content': user.disabled }" placement="top-start" offset="0">
|
<dropdown v-else :class="{ 'disabled-content': user.disabled }" placement="top-start" offset="0">
|
||||||
<template #default="{ openMenu, closeMenu, isOpen }">
|
<template #default="{ openMenu, closeMenu, isOpen }">
|
||||||
<nuxt-link
|
<nuxt-link
|
||||||
:to="userLink"
|
:to="userLink"
|
||||||
:class="['user', isOpen && 'active']"
|
:class="['user-teaser', isOpen && 'active']"
|
||||||
@mouseover.native="showPopover ? openMenu(true) : () => {}"
|
@mouseover.native="showPopover ? openMenu(true) : () => {}"
|
||||||
@mouseleave.native="closeMenu(true)"
|
@mouseleave.native="closeMenu(true)"
|
||||||
>
|
>
|
||||||
<user-avatar v-if="showAvatar" :user="user" />
|
<user-avatar v-if="showAvatar" :user="user" size="small" />
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<ds-text>
|
<span class="user-slug">
|
||||||
<b>{{ userSlug }}</b>
|
{{ userSlug }}
|
||||||
</ds-text>
|
<span class="username">{{ userName | truncate(18) }}</span>
|
||||||
<ds-text class="username" align="left" size="small" color="soft">
|
</span>
|
||||||
{{ userName | truncate(18) }}
|
|
||||||
</ds-text>
|
|
||||||
<ds-text class="date-time" align="left" size="small" color="soft">
|
<ds-text class="date-time" align="left" size="small" color="soft">
|
||||||
<template v-if="dateTime">
|
<template v-if="dateTime">
|
||||||
<base-icon name="clock" />
|
<base-icon name="clock" />
|
||||||
@ -82,7 +78,6 @@
|
|||||||
/>
|
/>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
</ds-flex>
|
</ds-flex>
|
||||||
<!--<ds-space margin-bottom="x-small" />-->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</dropdown>
|
</dropdown>
|
||||||
@ -98,7 +93,7 @@ import UserAvatar from '~/components/_new/generic/UserAvatar/UserAvatar'
|
|||||||
import Dropdown from '~/components/Dropdown'
|
import Dropdown from '~/components/Dropdown'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HcUser',
|
name: 'UserTeaser',
|
||||||
components: {
|
components: {
|
||||||
HcRelativeDateTime,
|
HcRelativeDateTime,
|
||||||
HcFollowButton,
|
HcFollowButton,
|
||||||
@ -152,31 +147,31 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style lang="scss">
|
||||||
.user {
|
.user-teaser {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
}
|
z-index: $z-index-hc-post-card-link;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.user-info {
|
> .user-info {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
> .ds-text {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 0 0 $space-xxx-small $space-xx-small;
|
flex-direction: column;
|
||||||
}
|
|
||||||
|
|
||||||
&:hover,
|
> .ds-text {
|
||||||
&.active {
|
display: flex;
|
||||||
z-index: 999;
|
margin: 0 0 $space-xxx-small $space-xx-small;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.date-time {
|
> .user-slug {
|
||||||
> .base-icon {
|
white-space: nowrap;
|
||||||
align-self: center;
|
text-overflow: ellipsis;
|
||||||
margin: $space-xxx-small $space-xxx-small 0 0;
|
margin: 0 0 $space-xxx-small $space-xx-small;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.username {
|
||||||
|
color: $text-color-soft;
|
||||||
|
font-size: $font-size-small;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
import { storiesOf } from '@storybook/vue'
|
||||||
|
import { withA11y } from '@storybook/addon-a11y'
|
||||||
|
import StoryRouter from 'storybook-vue-router'
|
||||||
|
import UserAvatar from '~/components/_new/generic/UserAvatar/UserAvatar'
|
||||||
|
import helpers from '~/storybook/helpers'
|
||||||
|
import { user } from '~/components/UserTeaser/UserTeaser.story.js'
|
||||||
|
|
||||||
|
helpers.init()
|
||||||
|
const anonymousUser = {
|
||||||
|
...user,
|
||||||
|
name: 'Anonymous',
|
||||||
|
avatar: null,
|
||||||
|
}
|
||||||
|
const userWithoutAvatar = {
|
||||||
|
...user,
|
||||||
|
avatar: null,
|
||||||
|
name: 'Ana Paula Nunes Marques',
|
||||||
|
}
|
||||||
|
storiesOf('UserAvatar', module)
|
||||||
|
.addDecorator(withA11y)
|
||||||
|
.addDecorator(helpers.layout)
|
||||||
|
.addDecorator(StoryRouter())
|
||||||
|
.add('with image', () => ({
|
||||||
|
components: { UserAvatar },
|
||||||
|
data: () => ({
|
||||||
|
user,
|
||||||
|
}),
|
||||||
|
template: '<user-avatar :user="user" />',
|
||||||
|
}))
|
||||||
|
.add('without image, anonymous user', () => ({
|
||||||
|
components: { UserAvatar },
|
||||||
|
data: () => ({
|
||||||
|
user: anonymousUser,
|
||||||
|
}),
|
||||||
|
template: '<user-avatar :user="user" />',
|
||||||
|
}))
|
||||||
|
.add('without image, user initials', () => ({
|
||||||
|
components: { UserAvatar },
|
||||||
|
data: () => ({
|
||||||
|
user: userWithoutAvatar,
|
||||||
|
}),
|
||||||
|
template: '<user-avatar :user="user" />',
|
||||||
|
}))
|
||||||
|
.add('small', () => ({
|
||||||
|
components: { UserAvatar },
|
||||||
|
data: () => ({
|
||||||
|
user,
|
||||||
|
}),
|
||||||
|
template: '<user-avatar :user="user" size="small"/>',
|
||||||
|
}))
|
||||||
|
.add('large', () => ({
|
||||||
|
components: { UserAvatar },
|
||||||
|
data: () => ({
|
||||||
|
user,
|
||||||
|
}),
|
||||||
|
template: '<user-avatar :user="user" size="large"/>',
|
||||||
|
}))
|
||||||
@ -1,16 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="[`size-${this.size}`, 'user-avatar']">
|
<div :class="[`--${this.size}`, 'user-avatar', { 'no-image': !hasImage || error }]">
|
||||||
<span v-if="!hasImage || error" class="no-image">
|
<img v-if="hasImage && !error" :src="user.avatar | proxyApiUrl" @error="onError" />
|
||||||
<span class="flex-item">
|
<base-icon name="eye-slash" v-else-if="isAnonymous" />
|
||||||
<template v-if="isAnonymous">
|
<span v-else>{{ userInitials }}</span>
|
||||||
<base-icon name="eye-slash" />
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ userInitials }}
|
|
||||||
</template>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<img v-if="user && user.avatar && !error" :src="user.avatar | proxyApiUrl" @error="onError" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -22,7 +14,7 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'base',
|
default: 'base',
|
||||||
validator: value => {
|
validator: value => {
|
||||||
return value.match(/(small|base|large|x-large)/)
|
return value.match(/(small|base|large)/)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
user: { type: Object, default: null },
|
user: { type: Object, default: null },
|
||||||
@ -37,7 +29,7 @@ export default {
|
|||||||
return !this.user || !this.user.name || this.user.name.toLowerCase() === 'anonymous'
|
return !this.user || !this.user.name || this.user.name.toLowerCase() === 'anonymous'
|
||||||
},
|
},
|
||||||
hasImage() {
|
hasImage() {
|
||||||
return Boolean(this.user && this.user.avatar) && !this.error
|
return Boolean(this.user && this.user.avatar)
|
||||||
},
|
},
|
||||||
userInitials() {
|
userInitials() {
|
||||||
const { name } = this.user || 'Anonymous'
|
const { name } = this.user || 'Anonymous'
|
||||||
@ -69,38 +61,28 @@ export default {
|
|||||||
margin-top: -0.1em;
|
margin-top: -0.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.size-small {
|
&.--small {
|
||||||
width: $size-avatar-small;
|
width: $size-avatar-small;
|
||||||
height: $size-avatar-small;
|
height: $size-avatar-small;
|
||||||
}
|
}
|
||||||
&.size-base {
|
&.--base {
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
width: $size-avatar-base;
|
width: $size-avatar-base;
|
||||||
height: $size-avatar-base;
|
height: $size-avatar-base;
|
||||||
}
|
}
|
||||||
&.size-large {
|
&.--large {
|
||||||
width: $size-avatar-large;
|
width: $size-avatar-large;
|
||||||
height: $size-avatar-large;
|
height: $size-avatar-large;
|
||||||
|
font-size: $font-size-xx-large;
|
||||||
}
|
}
|
||||||
&.size-x-large {
|
&.no-image {
|
||||||
width: $size-avatar-x-large;
|
|
||||||
height: $size-avatar-x-large;
|
|
||||||
}
|
|
||||||
.no-image {
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
background-color: $background-color-secondary;
|
background-color: $background-color-secondary;
|
||||||
color: $text-color-primary-inverse;
|
color: $text-color-primary-inverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-image .flex-item {
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0 auto;
|
|
||||||
align-self: center;
|
|
||||||
display: table;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
condensed
|
condensed
|
||||||
>
|
>
|
||||||
<template #submitter="scope">
|
<template #submitter="scope">
|
||||||
<hc-user
|
<user-teaser
|
||||||
:user="scope.row.submitter"
|
:user="scope.row.submitter"
|
||||||
:showAvatar="false"
|
:showAvatar="false"
|
||||||
:showPopover="false"
|
:showPopover="false"
|
||||||
@ -29,12 +29,12 @@
|
|||||||
</ds-table>
|
</ds-table>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import HcUser from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
import HcRelativeDateTime from '~/components/RelativeDateTime'
|
import HcRelativeDateTime from '~/components/RelativeDateTime'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
HcUser,
|
UserTeaser,
|
||||||
HcRelativeDateTime,
|
HcRelativeDateTime,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { storiesOf } from '@storybook/vue'
|
|||||||
import { withA11y } from '@storybook/addon-a11y'
|
import { withA11y } from '@storybook/addon-a11y'
|
||||||
import { action } from '@storybook/addon-actions'
|
import { action } from '@storybook/addon-actions'
|
||||||
import { post } from '~/components/PostCard/PostCard.story.js'
|
import { post } from '~/components/PostCard/PostCard.story.js'
|
||||||
import { user } from '~/components/User/User.story.js'
|
import { user } from '~/components/UserTeaser/UserTeaser.story.js'
|
||||||
import helpers from '~/storybook/helpers'
|
import helpers from '~/storybook/helpers'
|
||||||
import ReportList from './ReportList'
|
import ReportList from './ReportList'
|
||||||
import DropdownFilter from '~/components/DropdownFilter/DropdownFilter'
|
import DropdownFilter from '~/components/DropdownFilter/DropdownFilter'
|
||||||
|
|||||||
@ -19,7 +19,12 @@
|
|||||||
<!-- Content Column -->
|
<!-- Content Column -->
|
||||||
<td class="ds-table-col" data-test="report-content">
|
<td class="ds-table-col" data-test="report-content">
|
||||||
<client-only v-if="isUser">
|
<client-only v-if="isUser">
|
||||||
<hc-user :user="report.resource" :showAvatar="false" :trunc="30" :showPopover="false" />
|
<user-teaser
|
||||||
|
:user="report.resource"
|
||||||
|
:showAvatar="false"
|
||||||
|
:trunc="30"
|
||||||
|
:showPopover="false"
|
||||||
|
/>
|
||||||
</client-only>
|
</client-only>
|
||||||
<nuxt-link v-else class="title" :to="linkTarget">
|
<nuxt-link v-else class="title" :to="linkTarget">
|
||||||
{{ linkText | truncate(50) }}
|
{{ linkText | truncate(50) }}
|
||||||
@ -29,7 +34,7 @@
|
|||||||
<!-- Author Column -->
|
<!-- Author Column -->
|
||||||
<td class="ds-table-col" data-test="report-author">
|
<td class="ds-table-col" data-test="report-author">
|
||||||
<client-only v-if="!isUser">
|
<client-only v-if="!isUser">
|
||||||
<hc-user
|
<user-teaser
|
||||||
:user="report.resource.author"
|
:user="report.resource.author"
|
||||||
:showAvatar="false"
|
:showAvatar="false"
|
||||||
:trunc="30"
|
:trunc="30"
|
||||||
@ -46,7 +51,7 @@
|
|||||||
{{ statusText }}
|
{{ statusText }}
|
||||||
</span>
|
</span>
|
||||||
<client-only v-if="isReviewed">
|
<client-only v-if="isReviewed">
|
||||||
<hc-user
|
<user-teaser
|
||||||
:user="moderatorOfLatestReview"
|
:user="moderatorOfLatestReview"
|
||||||
:showAvatar="false"
|
:showAvatar="false"
|
||||||
:trunc="30"
|
:trunc="30"
|
||||||
@ -85,12 +90,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FiledReportsTable from '~/components/features/FiledReportsTable/FiledReportsTable'
|
import FiledReportsTable from '~/components/features/FiledReportsTable/FiledReportsTable'
|
||||||
import HcUser from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
FiledReportsTable,
|
FiledReportsTable,
|
||||||
HcUser,
|
UserTeaser,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
report: {
|
report: {
|
||||||
|
|||||||
@ -19,11 +19,11 @@
|
|||||||
@click="blurred = !blurred"
|
@click="blurred = !blurred"
|
||||||
/>
|
/>
|
||||||
</aside>
|
</aside>
|
||||||
<hc-user :user="post.author" :date-time="post.createdAt">
|
<user-teaser :user="post.author" :date-time="post.createdAt">
|
||||||
<template v-slot:dateTime>
|
<template v-slot:dateTime>
|
||||||
<ds-text v-if="post.createdAt !== post.updatedAt">({{ $t('post.edited') }})</ds-text>
|
<ds-text v-if="post.createdAt !== post.updatedAt">({{ $t('post.edited') }})</ds-text>
|
||||||
</template>
|
</template>
|
||||||
</hc-user>
|
</user-teaser>
|
||||||
<client-only>
|
<client-only>
|
||||||
<content-menu
|
<content-menu
|
||||||
placement="bottom-end"
|
placement="bottom-end"
|
||||||
@ -101,7 +101,7 @@ import ContentViewer from '~/components/Editor/ContentViewer'
|
|||||||
import HcCategory from '~/components/Category'
|
import HcCategory from '~/components/Category'
|
||||||
import HcHashtag from '~/components/Hashtag/Hashtag'
|
import HcHashtag from '~/components/Hashtag/Hashtag'
|
||||||
import ContentMenu from '~/components/ContentMenu/ContentMenu'
|
import ContentMenu from '~/components/ContentMenu/ContentMenu'
|
||||||
import HcUser from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
import HcShoutButton from '~/components/ShoutButton.vue'
|
import HcShoutButton from '~/components/ShoutButton.vue'
|
||||||
import HcCommentForm from '~/components/CommentForm/CommentForm'
|
import HcCommentForm from '~/components/CommentForm/CommentForm'
|
||||||
import HcCommentList from '~/components/CommentList/CommentList'
|
import HcCommentList from '~/components/CommentList/CommentList'
|
||||||
@ -119,7 +119,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
HcCategory,
|
HcCategory,
|
||||||
HcHashtag,
|
HcHashtag,
|
||||||
HcUser,
|
UserTeaser,
|
||||||
HcShoutButton,
|
HcShoutButton,
|
||||||
ContentMenu,
|
ContentMenu,
|
||||||
HcCommentForm,
|
HcCommentForm,
|
||||||
|
|||||||
@ -11,9 +11,9 @@
|
|||||||
style="position: relative; height: auto;"
|
style="position: relative; height: auto;"
|
||||||
>
|
>
|
||||||
<hc-upload v-if="myProfile" :user="user">
|
<hc-upload v-if="myProfile" :user="user">
|
||||||
<user-avatar :user="user" class="profile-avatar" size="x-large"></user-avatar>
|
<user-avatar :user="user" class="profile-avatar" size="large"></user-avatar>
|
||||||
</hc-upload>
|
</hc-upload>
|
||||||
<user-avatar v-else :user="user" class="profile-avatar" size="x-large" />
|
<user-avatar v-else :user="user" class="profile-avatar" size="large" />
|
||||||
<!-- Menu -->
|
<!-- Menu -->
|
||||||
<client-only>
|
<client-only>
|
||||||
<content-menu
|
<content-menu
|
||||||
@ -99,7 +99,7 @@
|
|||||||
<ds-space v-for="follow in uniq(user.following)" :key="follow.id" margin="x-small">
|
<ds-space v-for="follow in uniq(user.following)" :key="follow.id" margin="x-small">
|
||||||
<!-- TODO: find better solution for rendering errors -->
|
<!-- TODO: find better solution for rendering errors -->
|
||||||
<client-only>
|
<client-only>
|
||||||
<user :user="follow" :trunc="15" />
|
<user-teaser :user="follow" :trunc="15" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
<ds-space v-if="user.followingCount - user.following.length" margin="small">
|
<ds-space v-if="user.followingCount - user.following.length" margin="small">
|
||||||
@ -129,7 +129,7 @@
|
|||||||
<ds-space v-for="follow in uniq(user.followedBy)" :key="follow.id" margin="x-small">
|
<ds-space v-for="follow in uniq(user.followedBy)" :key="follow.id" margin="x-small">
|
||||||
<!-- TODO: find better solution for rendering errors -->
|
<!-- TODO: find better solution for rendering errors -->
|
||||||
<client-only>
|
<client-only>
|
||||||
<user :user="follow" :trunc="15" />
|
<user-teaser :user="follow" :trunc="15" />
|
||||||
</client-only>
|
</client-only>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
<ds-space v-if="user.followedByCount - user.followedBy.length" margin="small">
|
<ds-space v-if="user.followedByCount - user.followedBy.length" margin="small">
|
||||||
@ -271,7 +271,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import uniqBy from 'lodash/uniqBy'
|
import uniqBy from 'lodash/uniqBy'
|
||||||
import User from '~/components/User/User'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
import HcPostCard from '~/components/PostCard/PostCard.vue'
|
import HcPostCard from '~/components/PostCard/PostCard.vue'
|
||||||
import HcFollowButton from '~/components/FollowButton.vue'
|
import HcFollowButton from '~/components/FollowButton.vue'
|
||||||
import HcCountTo from '~/components/CountTo.vue'
|
import HcCountTo from '~/components/CountTo.vue'
|
||||||
@ -297,9 +297,8 @@ const tabToFilterMapping = ({ tab, id }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HcUserProfile',
|
|
||||||
components: {
|
components: {
|
||||||
User,
|
UserTeaser,
|
||||||
HcPostCard,
|
HcPostCard,
|
||||||
HcFollowButton,
|
HcFollowButton,
|
||||||
HcCountTo,
|
HcCountTo,
|
||||||
@ -516,7 +515,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.profile-avatar.user-avatar {
|
.profile-avatar.user-avatar {
|
||||||
display: block;
|
|
||||||
margin: auto;
|
margin: auto;
|
||||||
margin-top: -60px;
|
margin-top: -60px;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user