Skip to content

Commit 0260502

Browse files
committed
🐛 [fix] Input Validation Border 통일
1 parent cb4868d commit 0260502

File tree

8 files changed

+24
-15
lines changed

8 files changed

+24
-15
lines changed

src/components/request-approve/DueDateInput.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<input
33
:type="inputType"
44
:value="modelValue"
5-
class="w-full border border-gray-300 rounded px-3 py-2 cursor-pointer focus:outline-none text-center"
5+
class="w-full border border-border-1 rounded px-3 py-2 cursor-pointer focus:outline-none text-center"
6+
:class="isInvalidate ? 'border-red-1' : 'border-border-1'"
67
:min="inputType === 'date' ? minValue : undefined"
78
@focus="e => (e.target as HTMLInputElement).showPicker()"
89
@input="updateValue(($event.target as HTMLInputElement).value)" />
@@ -12,7 +13,7 @@
1213
import type { DueDateInputProps } from '@/types/common'
1314
import { computed, defineEmits, defineProps, onMounted } from 'vue'
1415
15-
const { modelValue, inputType } = defineProps<DueDateInputProps>()
16+
const { modelValue, inputType, isInvalidate } = defineProps<DueDateInputProps>()
1617
1718
const emit = defineEmits(['update:modelValue'])
1819

src/components/request-approve/ManagerDropdown.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
class="relative flex">
1515
<div
1616
class="request-task-dropdown"
17+
:class="isInvalidateState ? '!border-red-1' : ''"
1718
@click="toggleDropdown">
1819
<div class="flex gap-2 items-center">
1920
<ImageContainer

src/components/request-approve/RequestApprove.vue

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
v-model="category1"
1111
:options="mainCategoryArr"
1212
:label-name="'1차 카테고리'"
13-
:isInvalidate="isInvalidate"
13+
:isInvalidate="isInvalidate === 'category1' ? 'category' : ''"
1414
:isDisabled="false" />
1515
<CategoryDropDown
1616
v-model="category2"
1717
:options="afterSubCategoryArr"
1818
:label-name="'2차 카테고리'"
19-
:is-invalidate="isInvalidate"
19+
:isInvalidate="isInvalidate === 'category2' ? 'category' : ''"
2020
:isDisabled="!category1" />
2121
<ManagerDropdown
2222
v-model="approveData.processor"
2323
:placeholderText="'담당자를 선택해주세요'"
24-
:is-invalidate="isInvalidate" />
24+
:is-invalidate="isInvalidate === 'manager' ? 'manager' : ''" />
2525
<div class="flex flex-col gap-2">
2626
<div class="flex gap-2">
2727
<p class="text-body text-xs font-semibold">마감기한</p>
@@ -40,10 +40,12 @@
4040
<div class="flex w-full justify-center gap-6">
4141
<DueDateInput
4242
v-model="approveData.dueDate"
43-
inputType="date" />
43+
inputType="date"
44+
:is-invalidate="isInvalidate === 'date' ? 'date' : ''" />
4445
<DueDateInput
4546
v-model="approveData.dueTime"
46-
inputType="time" />
47+
inputType="time"
48+
:is-invalidate="isInvalidate === 'date' ? 'date' : ''" />
4749
</div>
4850
</div>
4951
<LabelDropdown
@@ -141,8 +143,12 @@ const handleCancel = () => {
141143
}
142144
143145
const handleSubmit = async () => {
144-
if (!category1.value || !category2.value) {
145-
isInvalidate.value = 'category'
146+
if (!category1.value) {
147+
isInvalidate.value = 'category1'
148+
return
149+
}
150+
if (!category2.value) {
151+
isInvalidate.value = 'category2'
146152
return
147153
}
148154
if (!approveData.value.processor?.memberId) {

src/components/request-task/CategoryDropDown.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
ref="htmlRef"
1818
class="relative flex">
1919
<div
20-
class="flex w-full h-11 items-center rounded p-4 border border-border-1"
21-
:class="isDisabled ? 'bg-background-2 cursor-default' : 'bg-white cursor-pointer'"
20+
class="flex w-full h-11 items-center rounded p-4 border"
21+
:class="`${isDisabled ? 'bg-background-2 cursor-default' : 'bg-white cursor-pointer'} ${isInvalidate ? 'border-red-1' : 'border-border-1'}`"
2222
@click="toggleDropdown">
2323
<p :class="{ 'text-disabled': !modelValue?.name }">
2424
{{ modelValue?.name ?? labelName + '를 선택해주세요' }}

src/components/request-task/ReRequestTask.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
v-model="title"
1919
:placeholderText="'제목을 입력해주세요'"
2020
:label-name="'제목'"
21-
:is-invalidate="isInvalidate" />
21+
:is-invalidate="isInvalidate === 'input' ? 'input' : ''" />
2222
<RequestTaskTextArea
2323
v-model="description"
2424
:is-invalidate="isInvalidate"

src/components/request-task/RequestTask.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
v-model="title"
1919
:placeholderText="'제목을 입력해주세요'"
2020
:label-name="'제목'"
21-
:is-invalidate="isInvalidate" />
21+
:is-invalidate="isInvalidate === 'input' ? 'input' : ''" />
2222
<RequestTaskTextArea
2323
v-model="description"
2424
:is-invalidate="isInvalidate"

src/components/request-task/RequestTaskInput.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
<p v-if="isInvalidateState === 'wrongNickname'">잘못된 형식의 아이디입니다</p>
1313
</div>
1414
<input
15-
class="w-full h-11 border border-border-1 px-4 focus:outline-none rounded"
15+
class="w-full h-11 border px-4 focus:outline-none rounded"
1616
:value="modelValue"
1717
:disabled="isEdit"
1818
@input="updateValue(($event.target as HTMLInputElement).value)"
1919
:placeholder="placeholderText"
20-
:class="{ 'text-gray-500': isEdit }"
20+
:class="`${isEdit ? 'text-gray-500' : ''} ${isInvalidate ? 'border-red-1' : 'border-border-1'}`"
2121
:maxlength="labelName === '제목' ? 30 : undefined" />
2222
</div>
2323
</template>

src/types/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export type Role = 'ROLE_USER' | 'ROLE_MANAGER' | 'ROLE_ADMIN'
6161
export interface DueDateInputProps {
6262
modelValue: string | null
6363
inputType: string
64+
isInvalidate?: string
6465
}
6566

6667
export interface FormButtonProps {

0 commit comments

Comments
 (0)