Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/app/(pages)/(albaform)/addform/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function AddFormPage() {
mode: "onChange",
defaultValues: {
isPublic: false,
hourlyWage: 10030,
hourlyWage: 0,
isNegotiableWorkDays: false,
workDays: [],
workEndTime: "",
Expand All @@ -34,7 +34,7 @@ export default function AddFormPage() {
age: "",
education: "",
gender: "",
numberOfPositions: 0,
numberOfPositions: undefined,
recruitmentEndDate: undefined,
recruitmentStartDate: undefined,
description: "",
Expand Down Expand Up @@ -217,13 +217,13 @@ export default function AddFormPage() {
onChange={handleOptionChange}
currentParam={currentParam || ""}
/>
<div className="absolute -bottom-[160px] mb-20 flex flex-col gap-2 lg:relative lg:bottom-0 lg:mb-0">
<div className="absolute -bottom-[160px] mb-20 flex w-full flex-col gap-2 lg:relative lg:bottom-0 lg:mb-0">
<Button
type="button"
variant="outlined"
width="md"
color="orange"
className="h-[58px] border bg-background-100 lg:h-[72px] lg:text-xl lg:leading-8"
className="lg: h-[58px] w-[320px] border bg-background-100 lg:h-[72px] lg:w-full lg:text-xl lg:leading-8"
onClick={() => onTempSave()}
disabled={!isDirty}
>
Expand All @@ -234,7 +234,7 @@ export default function AddFormPage() {
variant="solid"
width="md"
color="orange"
className="h-[58px] lg:h-[72px] lg:text-xl lg:leading-8"
className="lg: h-[58px] w-[320px] lg:h-[72px] lg:w-full lg:text-xl lg:leading-8"
disabled={!isValid}
onClick={handleSubmit(() => mutation.mutate())}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ export default function WorkConditionSection() {
}
};

// 시급 상태 추가
const [displayWage, setDisplayWage] = useState<string>("");
// 시급 상태 추가 (초기값: '25 최저시급)
const [displayWage, setDisplayWage] = useState<string>("10,030");

// 리액트 훅폼 데이터를 가져와서 렌더링
useEffect(() => {
const selectedDays = getValues("workDays") || [];
setSelectedWorkDays(selectedDays);
const wage = getValues("hourlyWage") || 0;
const wage = getValues("hourlyWage") || "10,030";
setDisplayWage(wage);
}, [getValues]);

Expand Down
12 changes: 2 additions & 10 deletions src/app/(pages)/(albaform)/alba/[formId]/edit/page.tsx
Copy link
Collaborator

@yyezzzy yyezzzy Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

제가 (albaform) 하위에 alba/[formid] 를 못보고 바깥 쪽에 alba/[formid] 만들어서 예림님 위치로 옮겼더니 (albaform) 하위 layout 때문에 css를 아무리 수정해도 잘 안되길래 못 합쳤어요 ㅠ 같은 폴더가 중복되버렸어요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네네 저도 폴더구조 확인했습니다! 저는 레이아웃때문에 그냥 별도로 (현상태 유지) 하는게 좋을거같습니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아니면 alba 폴더 합치고 경로에 따라 레이아웃 분기 처리 하는게 나을까요??
(edit, addform, apply -> (albaform) 폴더 내의 레이아웃 적용
& 그 외 (= /alba만 있는 경우) 예지님 레이아웃 적용

Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,10 @@ export default function EditFormPage() {
description: albaFormDetailData.description,
title: albaFormDetailData.title,
imageUrls: albaFormDetailData.imageUrls, // 프리뷰 반영하기
imageFiles: [],
});
}
}, [albaFormDetailData, reset]);

useEffect(() => {
if (albaFormDetailData) {
// console.log("data", data);
console.log("currentValues", currentValues);
}
}, [albaFormDetailData, currentValues]);

// 이미지 업로드 api
const uploadImages = async (files: File[]) => {
if (currentValues.imageUrls.length !== currentValues.imageFiles.length) {
Expand Down Expand Up @@ -232,13 +224,13 @@ export default function EditFormPage() {
onChange={handleOptionChange}
currentParam={currentParam || ""}
/>
<div className="absolute -bottom-[120px] mb-5 flex flex-col gap-2 lg:relative lg:bottom-0">
<div className="absolute -bottom-[120px] mb-10 flex w-[320px] lg:relative lg:bottom-0 lg:w-full">
<Button
type="submit"
variant="solid"
width="md"
color="orange"
className="h-[58px] lg:h-[72px] lg:text-xl lg:leading-8"
className="h-[58px] w-full lg:h-[72px] lg:text-xl lg:leading-8"
disabled={!isValid}
onClick={handleSubmit(() => mutation.mutate())}
>
Expand Down
14 changes: 8 additions & 6 deletions src/app/components/button/dropdown/InputDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,29 @@ const InputDropdown = forwardRef<HTMLInputElement, InputDropdownProps>(
const [isOpen, setIsOpen] = useState<boolean>(false);
const [selectedValue, setSelectedValue] = useState<string>("");
const [isCustomInput, setIsCustomInput] = useState<boolean>(false);
const { setValue, getValues } = useFormContext();
const { setValue, watch } = useFormContext();

const handleOptionClick = (option: string) => {
if (option === "직접 입력") {
setIsCustomInput(true);
setSelectedValue("");
// 동적으로 받아온 name에 값 할당 -> 훅폼에 저장
setValue(name, selectedValue);
setValue(name, selectedValue, { shouldDirty: true });
} else {
setSelectedValue(option);
setIsCustomInput(false);
setValue(name, option);
setValue(name, option, { shouldDirty: true });
setIsOpen(false);
}
};

// 작성중인 탭으로 다시 이동했을때 이전에 저장된 훅폼 데이터 연동
useEffect(() => {
const data = getValues();
setSelectedValue(data.name || "");
}, [getValues]);
const value = watch(name); // 동적으로 필드 값 가져오기
if (value !== undefined) {
setSelectedValue(value); // 초기값 동기화
}
}, [name, watch]);

const textStyle = "text-base";

Expand Down
Loading