Skip to content

Commit

Permalink
feat(form): use better input types
Browse files Browse the repository at this point in the history
  • Loading branch information
Aekal committed Nov 24, 2024
1 parent de7ce4d commit e957979
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
12 changes: 11 additions & 1 deletion src/components/BaseInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ const model = defineModel<string>()
<template>
<label class="flex flex-col gap-1.5">
{{ label }}
<input v-bind="$attrs" v-model="model" class="rounded border p-1.5 text-neutral-700" />
<input
v-bind="$attrs"
v-model="model"
class="rounded border p-1.5 text-neutral-700 placeholder:text-neutral-400"
/>
</label>
</template>

<style scoped>
input[type='date']:invalid::-webkit-datetime-edit {
@apply text-neutral-400;
}
</style>
2 changes: 1 addition & 1 deletion src/components/BaseTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const model = defineModel<string>()
<textarea
v-bind="$attrs"
v-model="model"
class="rounded border p-1.5 text-neutral-700"
class="rounded border p-1.5 text-neutral-700 placeholder:text-neutral-400"
rows="3"
/>
</label>
Expand Down
7 changes: 4 additions & 3 deletions src/views/ProfileEditView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,20 @@ const onSubmit = async () => {
/>
<BaseInput
v-model="phone"
type="text"
type="tel"
label="Phone"
placeholder="(123) 456-7890"
autocomplete="tel"
required
/>
<BaseInput
v-model="birthday"
type="text"
type="date"
label="Birthday"
placeholder="MM/DD/YYYY"
autocomplete="bday"
required
class="date-input"
:max="new Date().toISOString().split('T')[0]"
/>
<BaseTextarea
v-model="about"
Expand Down

0 comments on commit e957979

Please sign in to comment.