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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
<!--
- @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
-
- @author John Molakvoæ <skjnldsv@protonmail.com>
- @author Richard Steinmetz <richard@steinmetz.cloud>
-
- @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>
<!-- contact header -->
<header class="contact-header" :style="cssStyle">
<div class="contact-header__no-wrap">
<div class="contact-header__avatar">
<slot name="avatar" :avatar-size="avatarSize" />
</div>
<!-- fullname, org, title -->
<div class="contact-header__infos">
<h2 class="contact-header__infos-title">
<slot name="title" />
</h2>
<div v-if="$slots.subtitle" class="contact-header__infos-subtitle">
<slot name="subtitle" />
</div>
</div>
</div>
<!-- actions -->
<div class="contact-header__actions">
<slot name="actions" />
<!-- menu actions -->
<Actions ref="actions"
class="header-menu"
menu-align="right"
v-bind="$attrs">
<slot name="actions-menu" />
</Actions>
</div>
</header>
</template>
<script>
import { NcActions as Actions } from '@nextcloud/vue'
export default {
name: 'DetailsHeader',
components: {
Actions,
},
data() {
return {
avatarSize: 75,
}
},
computed: {
cssStyle() {
return {
'--avatar-size': this.avatarSize + 'px',
}
},
},
}
</script>
<style lang="scss" scoped>
@import '../../css/ContactDetailsLayout';
$top-padding: 50px;
// Header with avatar, name, position, actions...
.contact-header {
display: flex;
align-items: center;
padding: $top-padding 0 20px;
gap: $contact-details-row-gap;
@media (max-width: 1024px) {
// Top padding of 44px is already included in AppContent by default on mobile
padding-top: calc($top-padding - 44px);
// Wrap actions on mobile
flex-wrap: wrap;
&__no-wrap {
width: 100%;
}
&__infos {
// Account for nonexistent actions menu
width: calc($contact-details-value-max-width + $contact-details-row-gap + 44px) !important;
}
&__actions .header-menu {
margin-left: auto;
}
}
&__no-wrap {
display: flex;
gap: $contact-details-row-gap;
align-items: center;
min-width: 0;
}
// AVATAR
&__avatar {
// Global single column layout
display: flex;
flex: 0 1 auto;
justify-content: flex-end;
width: $contact-details-label-max-width;
min-width: 0; // Has to be zero unless we implement wrapping
}
// ORG-TITLE-NAME
&__infos {
flex-direction: column;
// Global single column layout
display: flex;
flex: 0 1 auto;
width: $contact-details-value-max-width;
min-width: 0; // Has to be zero unless we implement wrapping
&-title,
&-subtitle {
display: flex;
flex-wrap: wrap;
margin: 0;
}
:deep(input) {
flex: 1 auto;
}
&-title :deep(input) {
font-weight: bold;
}
&-subtitle:placeholder-shown {
max-width: 20%;
}
}
// ACTIONS
&__actions {
display: flex;
flex: 1 0 auto;
gap: 5px;
}
}
</style>
|