forms/src/components/UserDiv.vue

99 lines
2 KiB
Vue
Raw Normal View History

2019-05-14 01:15:45 +02:00
<!--
- @copyright Copyright (c) 2018 René Gieling <github@dartcafe.de>
-
- @author René Gieling <github@dartcafe.de>
-
- @license GNU AGPL version 3 or any later version
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-->
<template>
<div class="user-row">
<Avatar :user="shareWith" :display-name="computedDisplayName" :is-no-user="isNoUser" />
2019-05-14 01:15:45 +02:00
</div>
</template>
<script>
2020-02-26 13:26:40 +01:00
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
import ShareTypes from '../mixins/ShareTypes'
2019-05-14 01:15:45 +02:00
export default {
components: {
Avatar,
2019-05-14 01:15:45 +02:00
},
mixins: [ShareTypes],
2019-05-14 01:15:45 +02:00
props: {
shareWith: {
2019-05-14 01:15:45 +02:00
type: String,
required: true,
2019-05-14 01:15:45 +02:00
},
displayName: {
type: String,
required: true,
2019-05-14 01:15:45 +02:00
},
shareType: {
2019-05-14 01:15:45 +02:00
type: Number,
required: true,
},
2019-05-14 01:15:45 +02:00
},
computed: {
isNoUser() {
return this.shareType !== this.SHARE_TYPES.SHARE_TYPE_USER
2019-05-14 01:15:45 +02:00
},
computedDisplayName() {
if (this.shareType === this.SHARE_TYPES.SHARE_TYPE_GROUP) {
return `${this.displayName} (${t('forms', 'Group')})`
2019-05-14 01:15:45 +02:00
}
return this.displayName
},
2019-05-14 01:15:45 +02:00
},
2019-05-14 01:15:45 +02:00
}
</script>
<style lang="scss">
.user-row {
display: flex;
flex-grow: 0;
align-items: center;
margin-left: 0;
margin-top: 0;
2019-05-14 01:15:45 +02:00
> div {
margin: 2px 4px;
}
2019-05-14 01:15:45 +02:00
.description {
opacity: 0.7;
flex-grow: 0;
}
2019-05-14 01:15:45 +02:00
.avatar {
height: 32px;
width: 32px;
flex-grow: 0;
}
2019-05-14 01:15:45 +02:00
.user-name {
opacity: 0.5;
flex-grow: 1;
}
2019-05-14 01:15:45 +02:00
}
</style>