Skip to content

Commit 7ad5c21

Browse files
committed
fix: HabitForm UI
1 parent b6d196c commit 7ad5c21

File tree

3 files changed

+64
-11
lines changed

3 files changed

+64
-11
lines changed

app/components/EmptyHabits.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const createHabitModal = ref(false);
1717
<div class="text-xs text-neutral-400">Create a new habit to track your progress</div>
1818
</div>
1919
</ContentBox>
20-
<UModal v-model="createHabitModal" :ui="{ width: 'w-80', background: '', shadow: '', overlay: { base: 'backdrop-blur-2xl', background: 'dark:bg-black/60' } }">
20+
<UModal v-model="createHabitModal" :ui="{ width: 'w-96', background: '', shadow: '', overlay: { base: 'backdrop-blur-2xl', background: 'dark:bg-black/60' } }">
2121
<HabitForm @habitAdded="createHabitModal = false" />
2222
</UModal>
2323
</template>

app/components/HabitForm.vue

+62-9
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,66 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
4444
</script>
4545

4646
<template>
47-
<UForm :schema="schema" :state="formState" class="flex flex-col gap-4" @submit="onSubmit">
48-
<UFormGroup name="title">
49-
<UInput size="lg" v-model="formState.title" placeholder="Title" />
50-
</UFormGroup>
51-
<UFormGroup name="description">
52-
<UTextarea size="lg" v-model="formState.description" placeholder="Description (Markdown supported)" autoresize :maxrows="3" />
53-
</UFormGroup>
54-
<UButton size="lg" type="submit" label="Add Habit" block />
55-
</UForm>
47+
<div class="p-8">
48+
<UForm :schema="schema" :state="formState" class="flex flex-col gap-4" @submit="onSubmit">
49+
<UFormGroup name="title">
50+
<div class="input-container">
51+
<input v-model="formState.title" placeholder="Title..." />
52+
</div>
53+
</UFormGroup>
54+
<UFormGroup name="description">
55+
<div class="input-container">
56+
<textarea rows="5" v-model="formState.description" placeholder="Description (Markdown supported)..."></textarea>
57+
</div>
58+
</UFormGroup>
59+
<button type="submit" class="button bg-green-400 px-2.5 py-3 font-semibold text-green-950 outline-none hover:bg-green-300">Add Habit</button>
60+
</UForm>
61+
</div>
5662
</template>
63+
64+
<style lang="postcss" scoped>
65+
.input-container {
66+
@apply relative flex w-full items-center;
67+
}
68+
69+
input,
70+
textarea {
71+
box-shadow:
72+
inset 0.5px 0.5px 1px 0px rgba(255, 255, 255, 0.1),
73+
inset -0.5px -0.5px 1px 0px rgba(0, 0, 0, 0.1),
74+
rgba(0, 0, 0, 0.2) 0px 3px 10px -5px;
75+
@apply w-full rounded-2xl bg-white/10 p-4 outline-none transition-all placeholder:text-white/35;
76+
&:focus {
77+
@apply bg-white/15;
78+
}
79+
}
80+
81+
textarea {
82+
resize: none;
83+
--sb-track-color: rgba(0, 0, 0, 0);
84+
--sb-thumb-color: #666;
85+
--sb-size: 12px;
86+
}
87+
88+
textarea::-webkit-scrollbar {
89+
width: var(--sb-size);
90+
}
91+
92+
textarea::-webkit-scrollbar-track {
93+
background: var(--sb-track-color);
94+
margin-top: 10px;
95+
margin-bottom: 10px;
96+
}
97+
98+
textarea::-webkit-scrollbar-thumb {
99+
background: var(--sb-thumb-color);
100+
border-radius: 12px;
101+
border: 4px solid #242724;
102+
}
103+
104+
textarea {
105+
&:focus::-webkit-scrollbar-thumb {
106+
border: 4px solid #333633;
107+
}
108+
}
109+
</style>

app/components/ProfileActions.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const createHabitModal = ref(false);
1010
</button>
1111
<Dropdown />
1212
</div>
13-
<UModal v-model="createHabitModal" :ui="{ width: 'w-80', background: '', shadow: '', overlay: { base: 'backdrop-blur-2xl', background: 'dark:bg-black/60' } }">
13+
<UModal v-model="createHabitModal" :ui="{ width: 'w-96', background: '', shadow: '', overlay: { base: 'backdrop-blur-2xl', background: 'dark:bg-black/60' } }">
1414
<HabitForm @habitAdded="createHabitModal = false" />
1515
</UModal>
1616
</template>

0 commit comments

Comments
 (0)