Skip to content

Commit 6af672b

Browse files
author
fabienSvstr
committed
[MS] User list reponsive
1 parent d6584a1 commit 6af672b

File tree

7 files changed

+323
-213
lines changed

7 files changed

+323
-213
lines changed

client/src/components/files/FileListItem.vue

-20
Original file line numberDiff line numberDiff line change
@@ -228,26 +228,6 @@ async function onOptionsClick(event: PointerEvent): Promise<void> {
228228
}
229229
}
230230

231-
.file-options {
232-
ion-button::part(native) {
233-
padding: 0;
234-
}
235-
236-
.options-button {
237-
--background-hover: none;
238-
239-
&__icon {
240-
color: var(--parsec-color-light-secondary-grey);
241-
}
242-
243-
&:hover {
244-
.options-button__icon {
245-
color: var(--parsec-color-light-primary-500);
246-
}
247-
}
248-
}
249-
}
250-
251231
.file-list-item-mobile {
252232
overflow: hidden;
253233
text-overflow: ellipsis;

client/src/components/users/UserListItem.vue

+61-70
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<div class="user-selected">
2121
<!-- eslint-disable vue/no-mutating-props -->
2222
<ms-checkbox
23+
:class="{ 'checkbox-mobile': isSmallDisplay }"
2324
v-model="user.isSelected"
2425
v-show="user.isSelected || isHovered || showCheckbox"
2526
v-if="!user.isRevoked() && !user.isCurrent"
@@ -30,10 +31,12 @@
3031
</div>
3132

3233
<!-- user name -->
33-
<div class="user-name">
34+
<div
35+
class="user-name"
36+
v-if="isLargeDisplay"
37+
>
3438
<ion-label class="user-name__label cell">
3539
<user-avatar-name
36-
class="main-cell"
3740
:user-avatar="user.humanHandle.label"
3841
:user-name="user.humanHandle.label"
3942
/>
@@ -45,6 +48,29 @@
4548
</span>
4649
</ion-label>
4750
</div>
51+
<div
52+
class="user-mobile"
53+
v-if="isSmallDisplay"
54+
>
55+
<user-avatar-name
56+
:user-avatar="user.humanHandle.label"
57+
class="user-mobile-avatar"
58+
:class="{
59+
'hide-avatar': showCheckbox && !user.isRevoked() && !user.isCurrent,
60+
'disable-avatar': user.isRevoked() || user.isCurrent,
61+
}"
62+
/>
63+
<div class="user-mobile-text">
64+
<ion-text class="button-medium user-mobile-text__name">{{ user.humanHandle.label }}</ion-text>
65+
<ion-text class="cell user-mobile-text__email">
66+
{{ user.humanHandle.email }}
67+
</ion-text>
68+
<tag-profile
69+
:profile="user.currentProfile"
70+
class="user-mobile-text__profile"
71+
/>
72+
</div>
73+
</div>
4874

4975
<!-- user profile -->
5076
<div class="user-profile">
@@ -80,7 +106,7 @@
80106
<!-- options -->
81107
<div class="user-options ion-item-child-clickable">
82108
<ion-button
83-
v-show="(isHovered || menuOpened) && !user.isCurrent"
109+
v-show="((isHovered || menuOpened) && !user.isCurrent) || isSmallDisplay"
84110
fill="clear"
85111
class="options-button"
86112
@click.stop="onOptionsClick($event)"
@@ -96,17 +122,18 @@
96122
</template>
97123

98124
<script setup lang="ts">
99-
import { formatTimeSince, MsCheckbox } from 'megashark-lib';
125+
import { formatTimeSince, MsCheckbox, useWindowSize } from 'megashark-lib';
100126
import TagProfile from '@/components/users/TagProfile.vue';
101127
import UserAvatarName from '@/components/users/UserAvatarName.vue';
102128
import UserStatusTag from '@/components/users/UserStatusTag.vue';
103129
import { UserModel } from '@/components/users/types';
104-
import { IonButton, IonIcon, IonItem, IonLabel } from '@ionic/vue';
130+
import { IonButton, IonIcon, IonItem, IonLabel, IonText } from '@ionic/vue';
105131
import { ellipsisHorizontal } from 'ionicons/icons';
106132
import { ref } from 'vue';
107133

108134
const isHovered = ref(false);
109135
const menuOpened = ref(false);
136+
const { isLargeDisplay, isSmallDisplay } = useWindowSize();
110137

111138
const props = defineProps<{
112139
user: UserModel;
@@ -134,93 +161,57 @@ async function onOptionsClick(event: Event): Promise<void> {
134161
</script>
135162

136163
<style scoped lang="scss">
137-
.user-selected {
138-
min-width: 4rem;
139-
justify-content: end;
140-
width: auto;
141-
}
142-
143164
.user-name {
144-
padding: 0.5rem 1rem;
145-
width: auto;
146-
flex-grow: 1;
147-
min-width: 11.25rem;
148-
max-width: 25rem;
149-
150165
&__label {
151166
display: flex;
152167
align-items: center;
153168
gap: 0.5rem;
154169
overflow: hidden;
155-
156-
.main-cell {
157-
white-space: nowrap;
158-
overflow: hidden;
159-
}
160170
}
161171

162172
&__you {
163173
color: var(--parsec-color-light-primary-600);
164174
}
165175
}
166176

167-
.user-profile {
168-
min-width: 11.5rem;
169-
max-width: 10vw;
170-
width: auto;
171-
flex-grow: 2;
172-
}
177+
.user-mobile {
178+
display: flex;
179+
align-items: center;
180+
width: 100%;
181+
gap: 0.75rem;
182+
padding: 0.75rem 0.5rem;
173183

174-
.user-email {
175-
max-width: 16rem;
176-
min-width: 16rem;
177-
flex-grow: 0;
178-
color: var(--parsec-color-light-secondary-grey);
179-
overflow: hidden;
184+
.user-mobile-avatar {
185+
padding: 0.5rem;
180186

181-
&__label {
182-
overflow: hidden;
183-
text-overflow: ellipsis;
184-
white-space: nowrap;
185-
}
186-
}
187-
188-
.user-status {
189-
min-width: 8rem;
190-
width: auto;
191-
flex-grow: 0;
192-
color: var(--parsec-color-light-secondary-grey);
193-
}
194-
195-
.user-join {
196-
min-width: 11.25rem;
197-
flex-grow: 0;
198-
overflow: hidden;
199-
color: var(--parsec-color-light-secondary-grey);
200-
}
201-
202-
.user-options {
203-
min-width: 4rem;
204-
width: auto;
205-
flex-grow: 0;
206-
margin-left: auto;
187+
&.hide-avatar {
188+
opacity: 0;
189+
}
207190

208-
ion-button::part(native) {
209-
padding: 0;
191+
&.disable-avatar {
192+
filter: grayscale(100%);
193+
opacity: 0.6;
194+
}
210195
}
211196

212-
.options-button {
213-
--background-hover: none;
197+
&-text {
198+
display: flex;
199+
flex-direction: column;
200+
gap: 0.375rem;
214201

215-
&__icon {
216-
color: var(--parsec-color-light-secondary-grey);
202+
&__name {
203+
color: var(--parsec-color-light-secondary-text);
217204
}
218205

219-
&:hover {
220-
.options-button__icon {
221-
color: var(--parsec-color-light-primary-500);
222-
}
206+
&__email {
207+
color: var(--parsec-color-light-secondary-grey);
223208
}
224209
}
225210
}
211+
212+
.user-status,
213+
.user-join,
214+
.user-email {
215+
color: var(--parsec-color-light-secondary-grey);
216+
}
226217
</style>

0 commit comments

Comments
 (0)