aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/components/SharingEntrySimple.vue
blob: a5e4034cfb1cc14015f9effae8f923c6cd9e9372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!--
  - SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  - SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
	<li class="sharing-entry">
		<slot name="avatar" />
		<div class="sharing-entry__desc">
			<span class="sharing-entry__title">{{ title }}</span>
			<p v-if="subtitle">
				{{ subtitle }}
			</p>
		</div>
		<NcActions v-if="$slots['default']"
			ref="actionsComponent"
			class="sharing-entry__actions"
			menu-align="right"
			:aria-expanded="ariaExpandedValue">
			<slot />
		</NcActions>
	</li>
</template>

<script>
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'

export default {
	name: 'SharingEntrySimple',

	components: {
		NcActions,
	},

	props: {
		title: {
			type: String,
			default: '',
			required: true,
		},
		subtitle: {
			type: String,
			default: '',
		},
		isUnique: {
			type: Boolean,
			default: true,
		},
		ariaExpanded: {
			type: Boolean,
			default: null,
		},
	},

	computed: {
		ariaExpandedValue() {
			if (this.ariaExpanded === null) {
				return this.ariaExpanded
			}
			return this.ariaExpanded ? 'true' : 'false'
		},
	},
}
</script>

<style lang="scss" scoped>
.sharing-entry {
	display: flex;
	align-items: center;
	min-height: 44px;
	&__desc {
		padding: 8px;
		padding-inline-start: 10px;
		line-height: 1.2em;
		position: relative;
		flex: 1 1;
		min-width: 0;
		p {
			color: var(--color-text-maxcontrast);
		}
	}
	&__title {
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
		max-width: inherit;
	}
	&__actions {
		margin-inline-start: auto !important;
	}
}
</style>