Skip to content

Commit 44bf5e5

Browse files
committed
impove the friend search UI
1 parent cd19796 commit 44bf5e5

4 files changed

Lines changed: 38 additions & 9 deletions

File tree

client/src/assets/base.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap');
1+
@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap");
22

33
:root {
44
--vt-c-white: #ffffff;
@@ -35,9 +35,7 @@
3535

3636
--color-heading: var(--vt-c-text-light-1);
3737
--color-text: var(--vt-c-text-light-1);
38-
--color-text-soft: var()
39-
40-
--section-gap: 160px;
38+
--color-text-soft: var() --section-gap: 160px;
4139
}
4240

4341
@media (prefers-color-scheme: dark) {
@@ -80,7 +78,6 @@
8078
border-radius: 4px;
8179
}
8280

83-
8481
body {
8582
width: 100vw;
8683
height: 100vh;

client/src/assets/outline.svg

Lines changed: 1 addition & 0 deletions
Loading

client/src/assets/search.png

50.2 KB
Loading

client/src/containers/Friends.vue

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async function searchUsers(query: string | null) {
9090
});
9191
if (response.status === 200) {
9292
friendBriefs.value = response.data.map((user: any) =>
93-
mapResponseToUserBrief(user)
93+
mapResponseToUserBrief(user),
9494
);
9595
}
9696
}
@@ -117,7 +117,11 @@ async function searchUsers(query: string | null) {
117117

118118
<button
119119
class="h-full aspect-square rounded bg-color-background-mute text-primary flex items-center justify-center"
120-
@click="addFriendMode = false"
120+
@click="
121+
addFriendMode = false;
122+
friendBriefs = null;
123+
username = null;
124+
"
121125
v-if="addFriendMode"
122126
>
123127
<IconClose :size="50" />
@@ -137,7 +141,7 @@ async function searchUsers(query: string | null) {
137141
<div class="w-full h-full" v-if="addFriendMode">
138142
<div class="w-full h-auto flex px-4">
139143
<input
140-
class="w-[87%] h-10 px-3 rounded-l-md bg-color-background-mute border-none outline-none"
144+
class="w-[87%] h-10 px-3 rounded-l-md bg-color-background-mute placeholder:text-gray-500 border-none outline-none"
141145
type="text"
142146
placeholder="username"
143147
v-model="username"
@@ -152,12 +156,39 @@ async function searchUsers(query: string | null) {
152156
</div>
153157

154158
<div class="w-full h-auto mt-4">
155-
<div class="w-full h-16" v-for="user in friendBriefs">
159+
<div
160+
v-if="friendBriefs == null"
161+
class="w-full pt-20 flex flex-col items-center opacity-50"
162+
>
163+
<div class="max-w-52 w-[40%] h-auto aspect-square">
164+
<img
165+
class="w-full h-full object-cover"
166+
src="@/assets/search.png"
167+
alt=""
168+
/>
169+
</div>
170+
<span class="font-thin mt-2">Search for new friend 😎</span>
171+
</div>
172+
<div
173+
class="w-full h-16"
174+
v-else-if="friendBriefs.length > 0"
175+
v-for="user in friendBriefs"
176+
>
156177
<FriendPreview
157178
:data="user"
158179
@add-request-message="addRequestMessage"
159180
/>
160181
</div>
182+
<div v-else class="w-full pt-20 flex flex-col items-center opacity-50">
183+
<div class="max-w-52 w-[40%] h-auto aspect-square">
184+
<img
185+
class="w-full h-full object-cover"
186+
src="@/assets/outline.svg"
187+
alt=""
188+
/>
189+
</div>
190+
<span class="font-thin mt-2">No user found 🙁</span>
191+
</div>
161192
</div>
162193
</div>
163194

0 commit comments

Comments
 (0)