Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”€ λ³€κ²½λœ λ°•λžŒνšŒ 폼 생성 api 적용 #90

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

Ethen1264
Copy link
Contributor

@Ethen1264 Ethen1264 commented Feb 3, 2025

πŸ’‘ λ°°κ²½ 및 κ°œμš”

λ³€κ²½λœ λ°•λžŒνšŒ 폼 생성 api 적용

πŸ“ƒ μž‘μ—…λ‚΄μš©

  • ν•„μˆ˜ 사항 적용
  • 기타 사항 적용

Summary by CodeRabbit

  • λ¦¬νŒ©ν† λ§

    • 폼 ꡬ성 μš”μ†Œλ“€μ΄ μ΅œμ‹  μƒνƒœ 관리 방식과 μ—°λ™λ˜μ–΄, μ²΄ν¬λ°•μŠ€, ν† κΈ€ 및 λ“œλ‘­λ‹€μš΄ μΈν„°λž™μ…˜μ΄ 보닀 μΌκ΄€λ˜κ³  μ•ˆμ •μ μœΌλ‘œ κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
    • 폼 제좜 및 μ‹ κ·œ ν•„λ“œ μΆ”κ°€ μ‹œ, ν•„μˆ˜ 여뢀와 μΆ”κ°€ μ˜΅μ…˜ 데이터가 μ˜¬λ°”λ₯΄κ²Œ κ΄€λ¦¬λ˜λ„λ‘ 둜직이 κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
    • 이벀트 핸듀링 방식이 κ°œμ„ λ˜μ–΄ λΆˆν•„μš”ν•œ κΈ°λ³Έ λ™μž‘μ΄ 효과적으둜 λ°©μ§€λ©λ‹ˆλ‹€.
  • 버그 μˆ˜μ •

    • μ—¬λŸ¬ λ²„νŠΌμ— λͺ…μ‹œμ  μœ ν˜•μ΄ μΆ”κ°€λ˜μ–΄ μ˜λ„μΉ˜ μ•Šμ€ 폼 μ œμΆœμ„ λ°©μ§€ν–ˆμŠ΅λ‹ˆλ‹€.

@Ethen1264 Ethen1264 added ✨ Feature μ‹ κ·œ κΈ°λŠ₯ πŸ“¬ Type: API μ„œλ²„ API 톡신 labels Feb 3, 2025
@Ethen1264 Ethen1264 self-assigned this Feb 3, 2025
Copy link

coderabbitai bot commented Feb 3, 2025

Walkthrough

이 PR은 폼 κ΄€λ ¨ UI μ»΄ν¬λ„ŒνŠΈλ“€μ˜ ꡬ쑰와 이벀트 처리λ₯Ό κ°œμ„ ν•©λ‹ˆλ‹€. μ£Όμš” λ³€κ²½ μ‚¬ν•­μœΌλ‘œλŠ” CheckBox 및 RequiredToggle μ»΄ν¬λ„ŒνŠΈκ°€ 기쑴의 둜컬 μƒνƒœ λŒ€μ‹  react-hook-form의 useControllerλ₯Ό ν™œμš©ν•˜λ„λ‘ λ¦¬νŒ©ν† λ§λ˜μ—ˆκ³ , λ²„νŠΌ μ»΄ν¬λ„ŒνŠΈλ“€μ— type="button" 속성이 μΆ”κ°€λ˜μ–΄ λΆˆν•„μš”ν•œ 폼 μ œμΆœμ„ λ°©μ§€ν•©λ‹ˆλ‹€. λ˜ν•œ, FormTypeSelect와 AddItemButtonμ—μ„œ 이벀트 핸듀링이 κ°•ν™”λ˜μ—ˆμœΌλ©°, ToggleButton은 μ œμ–΄ν˜• μ»΄ν¬λ„ŒνŠΈλ‘œ μ „ν™˜λ˜μ—ˆμŠ΅λ‹ˆλ‹€. createForm μ»΄ν¬λ„ŒνŠΈμ—μ„œλŠ” 제좜 λ‘œμ§μ— μƒˆλ‘œμš΄ ν•„λ“œ(requiredStatus, otherJson)κ°€ ν¬ν•¨λ˜κ³ , preventEvent ν•¨μˆ˜λŠ” λ‹€μ–‘ν•œ 이벀트 νƒ€μž…μ„ μ²˜λ¦¬ν•˜λ„λ‘ ν™•μž₯λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Changes

파일(λ“€) λ³€κ²½ λ‚΄μš©
src/entities/create-form/ui/CheckBox/index.tsx, src/entities/create-form/ui/RequiredToggle/index.tsx react-hook-form 연동: 기쑴의 toggleCheck/둜컬 μƒνƒœ 제거, control 및 index props λ„μž…, useController ν™œμš©
src/entities/create-form/ui/CreateFormButton/index.tsx, src/entities/create-form/ui/DeleteButton/index.tsx, src/shared/ui/PageHeader/index.tsx λ²„νŠΌ μ»΄ν¬λ„ŒνŠΈμ— type="button" 속성 μΆ”κ°€ν•˜μ—¬ κΈ°λ³Έ 제좜 λ™μž‘ 방지
src/entities/create-form/ui/FormTypeSelect/index.tsx, src/shared/model/preventEvent.ts preventEvent ν•¨μˆ˜ 호좜 μΆ”κ°€ 및 이벀트 핸듀링 κ°œμ„ , 이벀트 νƒ€μž… ν™•μž₯
src/shared/types/create-form/type.ts FormValues μΈν„°νŽ˜μ΄μŠ€μ— requiredStatus: boolean 및 `otherJson: string
src/shared/ui/AddItemButton/index.tsx onClick prop의 νƒ€μž…μ„ React.MouseEventHandler<HTMLButtonElement>둜 ꡬ체화
src/shared/ui/ToggleButton/index.tsx ToggleButton을 μ œμ–΄ν˜• μ»΄ν¬λ„ŒνŠΈλ‘œ λ¦¬νŒ©ν† λ§: 둜컬 μƒνƒœ 제거, value 및 onChange props λ„μž…
src/views/create-form/ui/createForm/index.tsx 폼 제좜 둜직 μˆ˜μ •: preventEvent μ‚¬μš©, 제좜 데이터에 μΆ”κ°€ ν•„λ“œ(requiredStatus, otherJson) 포함, append κΈ°λ³Έκ°’ μ—…λ°μ΄νŠΈ
src/widgets/create-form/ui/FormContainer/index.tsx λΆˆν•„μš”ν•œ handleCheckBox ν•¨μˆ˜ 제거, CheckBox 및 RequiredToggle μ»΄ν¬λ„ŒνŠΈμ— control, index props 직접 전달, 이벀트 방지 ν•¨μˆ˜ inline 호좜

Sequence Diagram(s)

sequenceDiagram
    participant U as μ‚¬μš©μž
    participant CB as CheckBox/RequiredToggle
    participant RHF as react-hook-form
    participant CF as CreateForm
    participant PE as preventEvent

    U->>CB: μ²΄ν¬λ°•μŠ€ ν† κΈ€ 이벀트 λ°œμƒ
    CB->>RHF: useControllerλ₯Ό 톡해 폼 μƒνƒœ μ—…λ°μ΄νŠΈ
    Note right of RHF: μƒνƒœ λ³€κ²½ (otherJson, requiredStatus)
    U->>CF: 폼 제좜 λ²„νŠΌ 클릭
    CF->>PE: preventEvent 호좜둜 κΈ°λ³Έ 이벀트 방지
    CF->>RHF: 제좜 데이터 μˆ˜μ§‘ 및 ν¬λ§·νŒ…
    CF->>CF: createForm ν˜ΈμΆœν•˜μ—¬ 데이터 전솑
Loading

Possibly related PRs

Suggested labels

🐞 Bug

Suggested reviewers

  • happytaeyoon

Poem

λ‚˜λŠ” μž‘μ€ 토끼, μ½”λ“œ μˆ²μ„ 뛰놀며
μ²΄ν¬λ°•μŠ€ 속 μƒνƒœ λ³€ν™”λ₯Ό 즐기넀 🐰
λ²„νŠΌμ— "button"이라 μ™ΈμΉ˜λ©° 행보λ₯Ό λ°ν˜€
예방 ν•¨μˆ˜λ‘œ 이벀트λ₯Ό 막아내넀
μƒˆλ‘œμ›Œμ§„ μ½”λ“œ, λ°˜μ§μ΄λŠ” λ‹Ήκ·Όμ²˜λŸΌ
ν•¨κ»˜ λ‹¬λ¦¬λŠ” 이 κΈΈ, 행볡이 κ°€λ“ν•˜κΈΈ!

✨ Finishing Touches
  • πŸ“ Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/shared/ui/AddItemButton/index.tsx (1)

8-15: μ ‘κ·Όμ„± κ°œμ„ μ„ μœ„ν•œ μ œμ•ˆμ‚¬ν•­μ΄ μžˆμŠ΅λ‹ˆλ‹€.

λ²„νŠΌ κ΅¬ν˜„μ€ μ „λ°˜μ μœΌλ‘œ 잘 λ˜μ–΄μžˆμ§€λ§Œ, λ‹€μŒκ³Ό 같은 κ°œμ„ μ‚¬ν•­μ„ κ³ λ €ν•΄λ³΄μ‹œλ©΄ 쒋을 것 κ°™μŠ΅λ‹ˆλ‹€:

 <button
   type="button"
   className="mx-auto flex items-center gap-5"
+  aria-label="ν•­λͺ© μΆ”κ°€ν•˜κΈ°"
   onClick={onClick}
 >
-  <Plus fill="#448FFF" />
+  <Plus fill="var(--color-main-600)" />
   <div className="text-body3 text-main-600">μΆ”κ°€ν•˜κΈ°</div>
 </button>
  • 슀크린 리더 μ‚¬μš©μžλ₯Ό μœ„ν•œ aria-label μΆ”κ°€
  • ν•˜λ“œμ½”λ”©λœ 색상 값을 μ‹œλ§¨ν‹± ν† ν°μœΌλ‘œ λ³€κ²½
src/entities/create-form/ui/CheckBox/index.tsx (1)

19-20: 'etc' ν•˜λ“œμ½”λ”©κ°’ μƒμˆ˜ν™” μ œμ•ˆ
ν† κΈ€ μ‹œ 'etc' λ¬Έμžμ—΄λ‘œ κ³ μ •ν•˜λŠ” λ‘œμ§μ„ λ‹€λ₯Έ κ³³μ—μ„œλ„ μž¬μ‚¬μš©ν•˜κ±°λ‚˜ 뒀에 변동될 여지가 μžˆλ‹€λ©΄, μƒμˆ˜λ‚˜ enum으둜 κ΄€λ¦¬ν•˜λŠ” 편이 μ’‹μŠ΅λ‹ˆλ‹€.

src/views/create-form/ui/createForm/index.tsx (1)

112-118: νƒ€μž… μ•ˆμ •μ„±μ„ λ†’μ΄λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”.

μƒˆλ‘œμš΄ ν•„λ“œλ“€μ΄ 잘 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. νƒ€μž… μ•ˆμ •μ„±μ„ 높이기 μœ„ν•΄ μƒμˆ˜ 객체λ₯Ό μ‚¬μš©ν•˜λŠ” 것을 μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

const DEFAULT_QUESTION = {
  title: '',
  formType: 'SENTENCE' as const,
  options: [],
  requiredStatus: false,
  otherJson: null,
} as const;

// μ‚¬μš©μ‹œ
append({ ...DEFAULT_QUESTION });
πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 046e803 and 7989c99.

πŸ“’ Files selected for processing (12)
  • src/entities/create-form/ui/CheckBox/index.tsx (1 hunks)
  • src/entities/create-form/ui/CreateFormButton/index.tsx (1 hunks)
  • src/entities/create-form/ui/DeleteButton/index.tsx (1 hunks)
  • src/entities/create-form/ui/FormTypeSelect/index.tsx (3 hunks)
  • src/entities/create-form/ui/RequiredToggle/index.tsx (1 hunks)
  • src/shared/model/preventEvent.ts (1 hunks)
  • src/shared/types/create-form/type.ts (1 hunks)
  • src/shared/ui/AddItemButton/index.tsx (1 hunks)
  • src/shared/ui/PageHeader/index.tsx (1 hunks)
  • src/shared/ui/ToggleButton/index.tsx (1 hunks)
  • src/views/create-form/ui/createForm/index.tsx (3 hunks)
  • src/widgets/create-form/ui/FormContainer/index.tsx (1 hunks)
βœ… Files skipped from review due to trivial changes (3)
  • src/entities/create-form/ui/CreateFormButton/index.tsx
  • src/entities/create-form/ui/DeleteButton/index.tsx
  • src/shared/ui/PageHeader/index.tsx
πŸ”‡ Additional comments (22)
src/shared/ui/AddItemButton/index.tsx (1)

3-5: Props νƒ€μž… μ •μ˜κ°€ κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€!

onClick ν•Έλ“€λŸ¬μ˜ νƒ€μž…μ„ React.MouseEventHandler<HTMLButtonElement>둜 λ³€κ²½ν•œ 것은 쒋은 κ°œμ„ μž…λ‹ˆλ‹€. 이λ₯Ό 톡해 더 μ •ν™•ν•œ νƒ€μž… μ•ˆμ „μ„±μ„ ν™•λ³΄ν•˜κ³  이벀트 객체에 λŒ€ν•œ 접근이 κ°€λŠ₯ν•΄μ‘ŒμŠ΅λ‹ˆλ‹€.

src/entities/create-form/ui/CheckBox/index.tsx (7)

2-4: react-hook-form κ΄€λ ¨ import 잘 적용됨
react-hook-formκ³Ό FormValuesλ₯Ό μ •μƒμ μœΌλ‘œ 뢈러였고 있으며, ν”„λ‘œμ νŠΈ ꡬ쑰 상 μ μ ˆν•΄ λ³΄μž…λ‹ˆλ‹€.


7-8: Props에 control, index μΆ”κ°€
ν•΄λ‹Ή Propsκ°€ useController μ‚¬μš©μ„ μœ„ν•œ μ€‘μš”ν•œ μ˜μ‘΄μ„±μ„ λͺ…μ‹œν•˜κ³  μžˆμ–΄, λͺ…ν™•ν•˜κ³  μœ μ§€λ³΄μˆ˜μ—λ„ μœ λ¦¬ν•©λ‹ˆλ‹€.


12-17: useController μ‚¬μš© 방식 점검
defaultValue: null둜 μ„€μ •λœ 뢀뢄이 μ‹€μ œ 폼 둜직과 ν˜Έν™˜λ˜λŠ”μ§€ 확인이 ν•„μš”ν•©λ‹ˆλ‹€. null μƒνƒœμ—μ„œμ˜ 폼 λ°Έλ¦¬λ°μ΄μ…˜, 제좜 μ‹œ 데이터 처리 등이 μ›ν•˜λŠ” λŒ€λ‘œ λ™μž‘ν•˜λŠ”μ§€ ν•œλ²ˆ 더 확인해 μ£Όμ„Έμš”.


24-28: λ²„νŠΌ νƒ€μž… 지정 확인
type="button"으둜 지정해 폼 μ œμΆœμ„ λ§‰μ•„μ£ΌλŠ” μ²˜λ¦¬κ°€ μ •μƒμ μœΌλ‘œ μ΄λ€„μ‘ŒμŠ΅λ‹ˆλ‹€. 클릭 이벀트 μ‹œ 폼이 예기치 μ•Šκ²Œ μ „μ†‘λ˜μ§€ μ•Šλ„λ‘ μ„€μ •λœ 점이 μ’‹μŠ΅λ‹ˆλ‹€.


31-31: 동적 클래슀 넀이밍
field.value에 따라 ν΄λž˜μŠ€κ°€ 적절히 λ³€κ²½λ˜μ–΄, UI μƒνƒœ ν‘œν˜„μ΄ λͺ…ν™•ν•©λ‹ˆλ‹€.


34-34: 쑰건뢀 λ Œλ”λ§μ΄ μ§κ΄€μ μž…λ‹ˆλ‹€
field.value && <Check /> ν˜•νƒœλ‘œ λΆˆν•„μš”ν•œ λžœλ”λ§μ΄λ‚˜ κΈ΄ μ‚Όν•­ 연산을 μ΅œμ†Œν™”ν•œ 점이 κΉ”λ”ν•©λ‹ˆλ‹€.


37-37: ν…μŠ€νŠΈ 색상 처리
field.value 여뢀에 λ”°λ₯Έ ν…μŠ€νŠΈ 색상 값이 λͺ…μ‹œμ μ΄μ–΄μ„œ 가독성이 μ’‹μŠ΅λ‹ˆλ‹€.

src/shared/model/preventEvent.ts (1)

1-1: λ‹€μ–‘ν•œ 이벀트 νƒ€μž… 지원
preventEvent ν•¨μˆ˜κ°€ React.FormEvent | React.MouseEventλ₯Ό λͺ¨λ‘ μ²˜λ¦¬ν•˜λ„λ‘ κ°œμ„ λ˜μ–΄, λ²”μš©μ„±μ΄ ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/entities/create-form/ui/RequiredToggle/index.tsx (4)

2-4: react-hook-form import μ μ ˆμ„±
useControllerλ₯Ό ν†΅ν•œ 폼 μƒνƒœ 관리λ₯Ό μœ„ν•˜μ—¬ ν•„μš”ν•œ μ˜μ‘΄μ„±μ„ 잘 뢈러였고 μžˆμŠ΅λ‹ˆλ‹€.


6-9: Props μ •μ˜
controlκ³Ό indexλ₯Ό 톡해 폼 데이터에 μ ‘κ·Όν•˜λŠ” ꡬ쑰가 λͺ…ν™•ν•΄μ Έμ„œ μž¬μ‚¬μš©μ„±κ³Ό μœ μ§€λ³΄μˆ˜μ„±μ΄ λ†’μ•„μ‘ŒμŠ΅λ‹ˆλ‹€.


11-16: useController둜 μ—°λ™λœ ν† κΈ€ ν•„λ“œ
defaultValueλ₯Ό false둜 μ„€μ •ν•˜μ—¬ ν•„μˆ˜ μ—¬λΆ€λ₯Ό μ œμ–΄ν•˜λŠ” 둜직이 κ°„κ²°ν•˜κ³  μ§κ΄€μ μž…λ‹ˆλ‹€. 이후 폼 제좜 μ‹œ requiredStatus κ°’ μ²˜λ¦¬λ„ 정상 λ™μž‘ν•˜λŠ”μ§€ 확인해 μ£Όμ„Έμš”.


21-21: ToggleButton κ°’ 연동
value={field.value ?? false}λ₯Ό 톡해 κΈ°λ³Έκ°’ λˆ„λ½ 상황도 μš°νšŒν•˜λ©°, λ³€κ²½ μ‹œ field.onChangeλ₯Ό μ¦‰μ‹œ ν˜ΈμΆœν•΄ 폼 μƒνƒœκ°€ μžλ™ λ°˜μ˜λ©λ‹ˆλ‹€.κ΅¬ν˜„ μ˜λ„κ°€ λͺ…ν™•ν•˜λ―€λ‘œ μœ μ§€λ³΄μˆ˜μ— μœ λ¦¬ν•©λ‹ˆλ‹€.

src/shared/types/create-form/type.ts (1)

15-16: FormValues μΈν„°νŽ˜μ΄μŠ€μ— μƒˆλ‘œμš΄ ν•„λ“œκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

폼 생성 API의 μ—…λ°μ΄νŠΈμ— 맞좰 ν•„μˆ˜ ν•„λ“œμ™€ μΆ”κ°€ 데이터λ₯Ό μ§€μ›ν•˜λ„λ‘ νƒ€μž…μ΄ ν™•μž₯λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒ 사항을 확인해 μ£Όμ„Έμš”:

  • requiredStatus: ν•„μˆ˜ μž…λ ₯ μ—¬λΆ€λ₯Ό λ‚˜νƒ€λ‚΄λŠ” λΆˆλ¦¬μ–Έ κ°’
  • otherJson: μΆ”κ°€ 데이터λ₯Ό JSON λ¬Έμžμ—΄λ‘œ μ €μž₯ν•˜κ±°λ‚˜ null κ°’ ν—ˆμš©
src/shared/ui/ToggleButton/index.tsx (3)

4-7: Props μΈν„°νŽ˜μ΄μŠ€κ°€ λͺ…ν™•ν•˜κ²Œ μ •μ˜λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ»΄ν¬λ„ŒνŠΈμ˜ 계약을 λͺ…ν™•νžˆ ν•˜κ³  νƒ€μž… μ•ˆμ •μ„±μ„ 보μž₯ν•©λ‹ˆλ‹€.


9-13: μ œμ–΄ μ»΄ν¬λ„ŒνŠΈλ‘œ λ¦¬νŒ©ν† λ§λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

둜컬 μƒνƒœ λŒ€μ‹  propsλ₯Ό ν†΅ν•œ μƒνƒœ κ΄€λ¦¬λ‘œ λ³€κ²½λ˜μ–΄ μž¬μ‚¬μš©μ„±μ΄ ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.


16-22: λ²„νŠΌ νƒ€μž…μ΄ λͺ…μ‹œμ μœΌλ‘œ μ§€μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

type="button" 속성 μΆ”κ°€λ‘œ μ˜λ„ν•˜μ§€ μ•Šμ€ 폼 μ œμΆœμ„ λ°©μ§€ν•©λ‹ˆλ‹€.

src/entities/create-form/ui/FormTypeSelect/index.tsx (2)

43-46: 이벀트 μ²˜λ¦¬κ°€ κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

preventEventλ₯Ό μ‚¬μš©ν•˜μ—¬ μ˜λ„ν•˜μ§€ μ•Šμ€ 이벀트 μ „νŒŒλ₯Ό λ°©μ§€ν•©λ‹ˆλ‹€.


62-67: μ˜΅μ…˜ 선택 ν•Έλ“€λŸ¬κ°€ κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

이벀트 μ²˜λ¦¬μ™€ μƒνƒœ μ—…λ°μ΄νŠΈ 둜직이 λͺ…ν™•ν•˜κ²Œ κ΅¬μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/widgets/create-form/ui/FormContainer/index.tsx (2)

125-130: AddItemButton의 이벀트 μ²˜λ¦¬κ°€ κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

preventEventλ₯Ό μ‚¬μš©ν•˜μ—¬ μ•ˆμ „ν•œ ν•­λͺ© μΆ”κ°€λ₯Ό 보μž₯ν•©λ‹ˆλ‹€.


136-136: 폼 컨트둀 μ»΄ν¬λ„ŒνŠΈλ“€μ˜ propsκ°€ κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

CheckBox와 RequiredToggle μ»΄ν¬λ„ŒνŠΈκ°€ react-hook-form의 control을 직접 μ‚¬μš©ν•˜λ„λ‘ λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Also applies to: 144-144

src/views/create-form/ui/createForm/index.tsx (1)

63-64: 폼 데이터 ꡬ쑰가 적절히 ν™•μž₯λ˜μ—ˆμŠ΅λ‹ˆλ‹€!

ν•„μˆ˜ μž…λ ₯ 여뢀와 기타 JSON 데이터가 API μš”κ΅¬μ‚¬ν•­μ— 맞게 잘 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Comment on lines +83 to +89
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
preventEvent(e);
handleSubmit(onSubmit, (errors) => {
console.log(errors);
handleFormErrors(errors, showError);
})(e);
}}
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

μ—λŸ¬ 처리λ₯Ό κ°œμ„ ν•΄μ£Όμ„Έμš”.

μ½˜μ†” λ‘œκ·ΈλŠ” ν”„λ‘œλ•μ…˜ ν™˜κ²½μ—μ„œ μ œκ±°λ˜μ–΄μ•Ό ν•©λ‹ˆλ‹€. μ—λŸ¬ 처리λ₯Ό λ‹€μŒκ³Ό 같이 κ°œμ„ ν•˜λŠ” 것을 μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

  onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
    preventEvent(e);
    handleSubmit(onSubmit, (errors) => {
-     console.log(errors);
      handleFormErrors(errors, showError);
    })(e);
  }}
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
preventEvent(e);
handleSubmit(onSubmit, (errors) => {
console.log(errors);
handleFormErrors(errors, showError);
})(e);
}}
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
preventEvent(e);
handleSubmit(onSubmit, (errors) => {
handleFormErrors(errors, showError);
})(e);
}}

@Ethen1264 Ethen1264 merged commit 62b8290 into develop Feb 3, 2025
2 checks passed
@Ethen1264 Ethen1264 deleted the update/create-form branch February 4, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature μ‹ κ·œ κΈ°λŠ₯ πŸ“¬ Type: API μ„œλ²„ API 톡신
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants