Skip to content

Commit 3e299ab

Browse files
committed
fix: UI
1 parent bf660ac commit 3e299ab

File tree

3 files changed

+49
-11
lines changed

3 files changed

+49
-11
lines changed

app/app.vue

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ const emptyHabits = computed(() => habits.value?.length === 0);
1313
<template>
1414
<Container>
1515
<Transition name="fade" mode="out-in">
16-
<Card v-if="user" class="">
17-
<ProfileHeader />
18-
<HabitCard v-for="habit in habits" :key="habit.id" :habit="habit" />
19-
<EmptyHabits v-if="emptyHabits" />
16+
<Card v-if="user">
17+
<div class="relative z-10">
18+
<ProfileHeader />
19+
<HabitCard v-for="habit in habits" :key="habit.id" :habit="habit" />
20+
<EmptyHabits v-if="emptyHabits" />
21+
</div>
2022
</Card>
2123
<Card v-else class="items-start justify-center gap-7 p-6">
22-
<div class="flex w-5/6 flex-col gap-5">
24+
<div class="relative z-10 flex w-5/6 flex-col gap-5">
2325
<div class="h-12 w-12 rounded-2xl border-4 border-green-600 bg-green-400 shadow-lg"></div>
2426
<div class="text-lg font-medium">Habit Tracker</div>
2527
<div class="text-3xl font-medium">

app/components/Card.vue

+16-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,21 @@
66

77
<style lang="postcss" scoped>
88
.card {
9-
box-shadow:
10-
inset 0px 0px 2.5px 0px rgba(255, 255, 255, 0.1),
11-
inset 0px 0px 0px 0px rgba(0, 0, 0, 0.2),
12-
rgba(0, 0, 0, 0.4) 0px 15px 40px -10px;
13-
@apply flex flex-col rounded-[2.375rem] bg-black/50;
9+
@apply relative flex h-full w-full flex-col rounded-[2.375rem];
10+
&::before {
11+
@apply absolute inset-0 rounded-[2.375rem];
12+
background: rgba(0, 0, 0, 0.5);
13+
box-shadow: inset 2px 4px 16px 0 hsla(0, 0%, 97%, 0.06);
14+
-webkit-backdrop-filter: blur(50px);
15+
backdrop-filter: blur(50px);
16+
content: '';
17+
}
18+
&::after {
19+
@apply pointer-events-none absolute inset-0 rounded-[2.375rem];
20+
border: 1.5px solid hsla(0, 0%, 100%, 0.05);
21+
-webkit-mask-image: linear-gradient(180deg, #000, transparent);
22+
mask-image: linear-gradient(180deg, #000, transparent);
23+
content: '';
24+
}
1425
}
1526
</style>

app/components/Container.vue

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
1+
<script setup lang="ts">
2+
const backgroundImage = ref('/bg/bg1.jpg');
3+
const isTransitioning = ref(false);
4+
5+
const setBackground = (image: string) => {
6+
if (backgroundImage.value !== image) {
7+
isTransitioning.value = true;
8+
setTimeout(() => {
9+
backgroundImage.value = image;
10+
}, 300);
11+
}
12+
};
13+
</script>
14+
115
<template>
216
<div class="rmterp">
317
<div class="fzypcq">
418
<slot />
519
</div>
6-
<div class="absolute h-screen w-screen bg-cover bg-center blur" style="background-image: url('/bg/bg1.jpg')"></div>
20+
<div
21+
class="absolute h-screen w-screen bg-cover bg-center blur transition-opacity duration-300"
22+
:style="{ backgroundImage: `url('${backgroundImage}')`, opacity: isTransitioning ? 0 : 1 }"
23+
@transitionend="isTransitioning = false"></div>
24+
<div class="absolute bottom-8 left-8 flex gap-4">
25+
<button @click="setBackground('/bg/bg1.jpg')" class="bg-image-button" :style="{ backgroundImage: `url('/bg/bg1.jpg')` }"></button>
26+
<button @click="setBackground('/bg/bg2.jpg')" class="bg-image-button" :style="{ backgroundImage: `url('/bg/bg2.jpg')` }"></button>
27+
</div>
728
</div>
829
</template>
930

@@ -15,4 +36,8 @@
1536
.fzypcq {
1637
@apply z-10 mx-auto flex w-full max-w-sm flex-col gap-4 px-5;
1738
}
39+
40+
.bg-image-button {
41+
@apply h-12 w-12 rounded-full border-2 border-black/50 bg-cover bg-center transition-opacity hover:opacity-50;
42+
}
1843
</style>

0 commit comments

Comments
 (0)