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

πŸ”€ 폼 생성 μ»΄ν¬λ„ŒνŠΈ μ—…λ°μ΄νŠΈ #83

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

Ethen1264
Copy link
Contributor

@Ethen1264 Ethen1264 commented Jan 23, 2025

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

폼 생성 μ»΄ν¬λ„ŒνŠΈ μ—…λ°μ΄νŠΈ

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

  • 기타 μ»΄ν¬λ„ŒνŠΈ 뢄리
  • 폼 μ˜΅μ…˜ μ•„μ΄ν…œ μ»΄ν¬λ„ŒνŠΈ 뢄리

Summary by CodeRabbit

  • μƒˆλ‘œμš΄ κΈ°λŠ₯

    • μ˜΅μ…˜ λ Œλ”λ§μ„ μœ„ν•œ μž¬μ‚¬μš© κ°€λŠ₯ν•œ μ»΄ν¬λ„ŒνŠΈ(OptionItem, OtherOption) μΆ”κ°€
    • λ‹€μ–‘ν•œ μ˜΅μ…˜ μœ ν˜•(μ²΄ν¬λ°•μŠ€, λ“œλ‘­λ‹€μš΄, 닀쀑 선택, κ·Έλ¦Ό, ν…μŠ€νŠΈ)에 λŒ€ν•œ μ»΄ν¬λ„ŒνŠΈ ꡬ쑰 κ°œμ„ 
  • λ¦¬νŒ©ν„°λ§

    • μ˜΅μ…˜ λ Œλ”λ§ λ‘œμ§μ„ λͺ¨λ“ˆν™”ν•˜μ—¬ μ½”λ“œ 가독성 및 μœ μ§€λ³΄μˆ˜μ„± ν–₯상
    • μ»΄ν¬λ„ŒνŠΈ κ°„ props 전달 방식 μ΅œμ ν™”

@Ethen1264 Ethen1264 added the 🎨 Type: Publishing λ””μžμΈ κ΅¬ν˜„ label Jan 23, 2025
@Ethen1264 Ethen1264 self-assigned this Jan 23, 2025
Copy link

coderabbitai bot commented Jan 23, 2025

Walkthrough

이 ν’€ λ¦¬ν€˜μŠ€νŠΈλŠ” 생성 μ–‘μ‹μ˜ λ‹€μ–‘ν•œ μ˜΅μ…˜ μ»΄ν¬λ„ŒνŠΈλ“€μ„ λ¦¬νŒ©ν† λ§ν•˜λŠ” μž‘μ—…μ„ ν¬ν•¨ν•©λ‹ˆλ‹€. μ£Όμš” λ³€κ²½ 사항은 OptionItemκ³Ό OtherOptionμ΄λΌλŠ” 두 개의 μƒˆλ‘œμš΄ μž¬μ‚¬μš© κ°€λŠ₯ν•œ μ»΄ν¬λ„ŒνŠΈλ₯Ό λ„μž…ν•˜μ—¬ μ½”λ“œμ˜ λͺ¨λ“ˆμ„±κ³Ό 가독성을 κ°œμ„ ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. μ²΄ν¬λ°•μŠ€, λ“œλ‘­λ‹€μš΄, 닀쀑 선택, κ·Έλ¦Ό, ν…μŠ€νŠΈ μ˜΅μ…˜ μ»΄ν¬λ„ŒνŠΈλ“€μ΄ μ΄λŸ¬ν•œ μƒˆλ‘œμš΄ μ»΄ν¬λ„ŒνŠΈλ₯Ό ν™œμš©ν•˜λ„λ‘ μ—…λ°μ΄νŠΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Changes

파일 λ³€κ²½ μš”μ•½
src/entities/create-form/ui/OptionItem/index.tsx μƒˆλ‘œμš΄ OptionItem μ»΄ν¬λ„ŒνŠΈ μΆ”κ°€
src/entities/create-form/ui/OtherOptionProps/index.tsx μƒˆλ‘œμš΄ OtherOption μ»΄ν¬λ„ŒνŠΈ μΆ”κ°€
src/entities/create-form/ui/*/index.tsx μ˜΅μ…˜ λ Œλ”λ§ λ‘œμ§μ„ OptionItemκ³Ό OtherOption으둜 λ¦¬νŒ©ν† λ§

Suggested labels

✨ Feature

Suggested reviewers

  • happytaeyoon

Poem

🐰 μ˜΅μ…˜μ˜ 세계λ₯Ό λ¦¬νŒ©ν† λ§ν•΄μš”
λͺ¨λ“ˆμ„± λ†’μ΄λŠ” μ½”λ“œμ˜ λ§ˆλ²•
μž¬μ‚¬μš© μ»΄ν¬λ„ŒνŠΈλ‘œ λΉ›λ‚˜λŠ” κΈΈ
κΉ”λ”ν•˜κ³  μš°μ•„ν•œ μ½”λ“œμ˜ μΆ€
개발의 즐거움을 λ…Έλž˜ν•΄μš”! πŸŽ‰


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 (7)
src/entities/create-form/ui/MultipleChoiceOption/index.tsx (1)

27-27: OtherOption κ΅¬ν˜„μ΄ 간단λͺ…λ£Œν•©λ‹ˆλ‹€.

μ‚Όν•­ μ—°μ‚°μžλ₯Ό μ‚¬μš©ν•œ 쑰건뢀 λ Œλ”λ§μ΄ κΉ”λ”ν•˜κ²Œ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μΆ”κ°€ μ œμ•ˆ: ν–₯ν›„ "기타" ν…μŠ€νŠΈλ₯Ό μƒμˆ˜λ‘œ λΆ„λ¦¬ν•˜μ—¬ κ΄€λ¦¬ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”.

+ const OTHER_OPTION_TEXT = "기타";
  // ...
- {isCheckBox ? <OtherOption text="기타" /> : null}
+ {isCheckBox ? <OtherOption text={OTHER_OPTION_TEXT} /> : null}
src/entities/create-form/ui/CheckBoxOption/index.tsx (1)

27-27: 쑰건뢀 λ Œλ”λ§ 둜직 κ°œμ„  πŸ‘

isCheckBox 쑰건에 λ”°λ₯Έ OtherOption μ»΄ν¬λ„ŒνŠΈ λ Œλ”λ§μ΄ κ°„κ²°ν•˜κ²Œ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ‚Όν•­ μ—°μ‚°μž μ‚¬μš©μ΄ μ μ ˆν•©λ‹ˆλ‹€.

μΆ”κ°€ μ œμ•ˆ: ν–₯ν›„ λ‹€κ΅­μ–΄ 지원을 κ³ λ €ν•œλ‹€λ©΄ "기타" ν…μŠ€νŠΈλ₯Ό μƒμˆ˜λ‘œ λΆ„λ¦¬ν•˜λŠ” 것이 쒋을 것 κ°™μŠ΅λ‹ˆλ‹€.

+const OTHER_OPTION_TEXT = "기타";

const CheckBoxOption = ({
  // ...
}) => {
  return (
    <div className="space-y-2">
      {fields.map((option, optionIndex) => (
        <OptionItem
          // ...
        />
      ))}
-      {isCheckBox ? <OtherOption text="기타" /> : null}
+      {isCheckBox ? <OtherOption text={OTHER_OPTION_TEXT} /> : null}
    </div>
  );
};
src/entities/create-form/ui/OtherOptionProps/index.tsx (1)

8-16: μ»΄ν¬λ„ŒνŠΈ ꡬ쑰가 κΉ”λ”ν•©λ‹ˆλ‹€λ§Œ, μ ‘κ·Όμ„± κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

μ»΄ν¬λ„ŒνŠΈκ°€ 잘 λͺ¨λ“ˆν™”λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. λ‹€λ§Œ 슀크린 리더 μ‚¬μš©μžλ₯Ό μœ„ν•΄ 의미둠적 λ§ˆν¬μ—…μ„ μΆ”κ°€ν•˜λ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•˜λŠ” 것을 μ œμ•ˆν•©λ‹ˆλ‹€:

 <div className="flex w-full items-center gap-[10px]">
   {icon}
-  <p className="text-body4 text-black">{text}</p>
-  <p className="text-caption2 text-gray-300">(μ§μ ‘μž…λ ₯)</p>
+  <span className="text-body4 text-black">{text}</span>
+  <span className="text-caption2 text-gray-300" aria-label="직접 μž…λ ₯ μ˜΅μ…˜">(μ§μ ‘μž…λ ₯)</span>
 </div>
src/entities/create-form/ui/PictureOption/index.tsx (1)

10-18: OptionItem μ»΄ν¬λ„ŒνŠΈλ₯Ό ν™œμš©ν•œ λ¦¬νŒ©ν† λ§μ΄ 잘 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

props 전달이 λͺ…ν™•ν•˜κ³  일관성 있게 κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. 특히 key prop의 μ‚¬μš©μ΄ μ μ ˆν•©λ‹ˆλ‹€.

λ‹€λ§Œ, FormPicture μ•„μ΄μ½˜μ˜ 크기가 ν•˜λ“œμ½”λ”©λ˜μ–΄ μžˆμ–΄ μž¬μ‚¬μš©μ„±μ΄ μ œν•œλ  수 μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” 선택적 κ°œμ„ μ‚¬ν•­μž…λ‹ˆλ‹€.

- icon={<FormPicture width="16" height="16" />}
+ icon={<FormPicture className="w-4 h-4" />}
src/entities/create-form/ui/TextOption/index.tsx (1)

25-25: 쑰건뢀 λ Œλ”λ§ λ‘œμ§μ„ κ°œμ„ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

μ‚Όν•­ μ—°μ‚°μž λŒ€μ‹  더 κ°„λ‹¨ν•œ 논리 μ—°μ‚°μžλ₯Ό μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

- {isCheckBox ? <OtherOption text="기타" /> : null}
+ {isCheckBox && <OtherOption text="기타" />}
src/entities/create-form/ui/DropDownOption/index.tsx (1)

26-26: 쑰건뢀 λ Œλ”λ§ λ‘œμ§μ„ κ°œμ„ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

TextOption μ»΄ν¬λ„ŒνŠΈμ™€ λ™μΌν•œ νŒ¨ν„΄μ΄ μ‚¬μš©λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 같은 λ°©μ‹μœΌλ‘œ κ°œμ„ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

- {isCheckBox ? <OtherOption text="기타" /> : null}
+ {isCheckBox && <OtherOption text="기타" />}
src/entities/create-form/ui/OptionItem/index.tsx (1)

1-13: νƒ€μž… μ •μ˜κ°€ 잘 λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€!

μΈν„°νŽ˜μ΄μŠ€μ™€ νƒ€μž… μ •μ˜κ°€ λͺ…ν™•ν•˜κ³  νƒ€μž… μ•ˆμ „μ„±μ΄ 잘 보μž₯λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. 특히 inputName의 ν…œν”Œλ¦Ώ λ¦¬ν„°λŸ΄ νƒ€μž…μ΄ μΈμƒμ μž…λ‹ˆλ‹€.

λ‹€λ§Œ, μž¬μ‚¬μš©μ„±μ„ μœ„ν•΄ OptionItemProps μΈν„°νŽ˜μ΄μŠ€λ₯Ό λ³„λ„μ˜ types.ts 파일둜 λΆ„λ¦¬ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”.

+// src/entities/create-form/ui/OptionItem/types.ts
+export interface OptionItemProps {
+  optionId: string;
+  icon?: ReactNode;
+  optionIndex: number;
+  register: UseFormRegister<FormValues>;
+  remove: (index: number) => void;
+  inputName: `questions.${number}.options.${number}.value`;
+}
πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between a875825 and ff348c0.

πŸ“’ Files selected for processing (7)
  • src/entities/create-form/ui/CheckBoxOption/index.tsx (2 hunks)
  • src/entities/create-form/ui/DropDownOption/index.tsx (2 hunks)
  • src/entities/create-form/ui/MultipleChoiceOption/index.tsx (2 hunks)
  • src/entities/create-form/ui/OptionItem/index.tsx (1 hunks)
  • src/entities/create-form/ui/OtherOptionProps/index.tsx (1 hunks)
  • src/entities/create-form/ui/PictureOption/index.tsx (1 hunks)
  • src/entities/create-form/ui/TextOption/index.tsx (2 hunks)
πŸ”‡ Additional comments (8)
src/entities/create-form/ui/MultipleChoiceOption/index.tsx (2)

4-5: μ»΄ν¬λ„ŒνŠΈ 뢄리가 잘 μ΄λ£¨μ–΄μ‘ŒμŠ΅λ‹ˆλ‹€! πŸ‘

OptionItemκ³Ό OtherOption μ»΄ν¬λ„ŒνŠΈλ₯Ό λΆ„λ¦¬ν•¨μœΌλ‘œμ¨ μ½”λ“œμ˜ μž¬μ‚¬μš©μ„±κ³Ό μœ μ§€λ³΄μˆ˜μ„±μ΄ ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.


17-25: OptionItem μ»΄ν¬λ„ŒνŠΈμ˜ κ΅¬ν˜„μ΄ κΉ”λ”ν•©λ‹ˆλ‹€.

각 μ˜΅μ…˜ μ•„μ΄ν…œμ„ λ³„λ„μ˜ μ»΄ν¬λ„ŒνŠΈλ‘œ λΆ„λ¦¬ν•˜μ—¬ μ²˜λ¦¬ν•˜λŠ” 방식이 맀우 λͺ…ν™•ν•˜κ³  μ²΄κ³„μ μž…λ‹ˆλ‹€. props 전달도 잘 κ΅¬μ„±λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

λ‹€λ§Œ, νƒ€μž… μ•ˆμ •μ„±μ„ μœ„ν•΄ λ‹€μŒ 사항을 ν™•μΈν•΄μ£Όμ‹œλ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€:

  • option.idκ°€ 항상 μ‘΄μž¬ν•˜λŠ”μ§€
  • register ν•¨μˆ˜μ˜ λ°˜ν™˜ νƒ€μž…μ΄ OptionItem의 κΈ°λŒ€κ°’κ³Ό μΌμΉ˜ν•˜λŠ”μ§€
src/entities/create-form/ui/CheckBoxOption/index.tsx (2)

4-5: μƒˆλ‘œμš΄ μ»΄ν¬λ„ŒνŠΈ μž„ν¬νŠΈ 확인 ν•„μš”

μƒˆλ‘œ μΆ”κ°€λœ OptionItemκ³Ό OtherOption μ»΄ν¬λ„ŒνŠΈμ˜ κ²½λ‘œκ°€ μ˜¬λ°”λ₯Έμ§€ 확인이 ν•„μš”ν•©λ‹ˆλ‹€. 특히 OtherOptionPropsλΌλŠ” 파일λͺ…이 μ˜μ‹¬μŠ€λŸ½μŠ΅λ‹ˆλ‹€. OtherOption으둜 μˆ˜μ •ν•΄μ•Ό ν•  것 κ°™μŠ΅λ‹ˆλ‹€.


17-25: μ»΄ν¬λ„ŒνŠΈ μž¬μ‚¬μš©μ„± κ°œμ„ μ„ μœ„ν•œ λ¦¬νŒ©ν† λ§ πŸ‘

OptionItem μ»΄ν¬λ„ŒνŠΈλ₯Ό μ‚¬μš©ν•˜μ—¬ μ½”λ“œμ˜ μž¬μ‚¬μš©μ„±κ³Ό μœ μ§€λ³΄μˆ˜μ„±μ΄ 크게 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€. props 전달이 λͺ…ν™•ν•˜κ³  μ²΄κ³„μ μœΌλ‘œ 이루어져 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€λ§Œ, νƒ€μž… μ•ˆμ •μ„±μ„ μœ„ν•΄ λ‹€μŒ 사항듀을 ν™•μΈν•΄μ£Όμ„Έμš”:

  1. option.idκ°€ 항상 μ‘΄μž¬ν•˜λŠ”μ§€
  2. register ν•¨μˆ˜μ˜ λ°˜ν™˜ νƒ€μž…μ΄ OptionItem의 κΈ°λŒ€κ°’κ³Ό μΌμΉ˜ν•˜λŠ”μ§€
βœ… Verification successful

νƒ€μž… μ•ˆμ •μ„± 검증 μ™„λ£Œ βœ…

검증 κ²°κ³Ό λ‹€μŒ 사항듀이 ν™•μΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€:

  • option.idλŠ” λͺ¨λ“  μ˜΅μ…˜ μ»΄ν¬λ„ŒνŠΈμ—μ„œ μΌκ΄€λ˜κ²Œ μ‚¬μš©λ˜κ³  있으며, νƒ€μž…μ΄ μ•ˆμ „ν•˜κ²Œ μ •μ˜λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.
  • register ν•¨μˆ˜μ˜ νƒ€μž…(UseFormRegister<FormValues>)이 OptionItem의 props νƒ€μž…κ³Ό μ •ν™•νžˆ μΌμΉ˜ν•©λ‹ˆλ‹€.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check type definitions and usages

# Search for type definitions
ast-grep --pattern 'interface OptionProps {
  $$$
}'

# Search for OptionItem props type
ast-grep --pattern 'interface $_ {
  icon: $_
  optionId: $_
  optionIndex: $_
  register: $_
  remove: $_
  inputName: $_
}'

Length of output: 655


Script:

#!/bin/bash
# Find OptionItem component definition and its props interface
ast-grep --pattern 'interface OptionItemProps {
  $$$
}'

# Find the component implementation
ast-grep --pattern 'const OptionItem = ({ $$ }: $_) => {
  $$$
}'

# Find where option.id is used/defined
rg "option\.id" -t typescript -t tsx

Length of output: 841


Script:

#!/bin/bash
# Search for option.id usage with correct file extensions
rg "option\.id" --type-add 'ts:*.{ts,tsx}' --type ts

Length of output: 1446

src/entities/create-form/ui/OtherOptionProps/index.tsx (1)

3-6: Props μΈν„°νŽ˜μ΄μŠ€κ°€ 잘 μ •μ˜λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

νƒ€μž…μ΄ λͺ…ν™•ν•˜κ²Œ μ •μ˜λ˜μ–΄ 있고, 선택적 props와 ν•„μˆ˜ propsκ°€ μ μ ˆν•˜κ²Œ κ΅¬λΆ„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

src/entities/create-form/ui/TextOption/index.tsx (1)

16-23: OptionItem의 κ΅¬ν˜„μ΄ 일관성 있게 잘 λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€.

λ‹€λ₯Έ μ˜΅μ…˜ μ»΄ν¬λ„ŒνŠΈλ“€κ³Ό λ™μΌν•œ νŒ¨ν„΄μ„ λ”°λ₯΄κ³  μžˆμ–΄ μ½”λ“œμ˜ 일관성이 잘 μœ μ§€λ˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

src/entities/create-form/ui/DropDownOption/index.tsx (1)

18-18: icon prop의 νƒ€μž… μ•ˆμ „μ„±μ„ κ°œμ„ ν•΄μ•Ό ν•©λ‹ˆλ‹€.

ν˜„μž¬ 숫자λ₯Ό 직접 icon prop으둜 μ „λ‹¬ν•˜κ³  μžˆλŠ”λ°, μ΄λŠ” OptionItem μ»΄ν¬λ„ŒνŠΈμ˜ νƒ€μž… μ •μ˜μ™€ μΌμΉ˜ν•˜μ§€ μ•Šμ„ 수 μžˆμŠ΅λ‹ˆλ‹€.

OptionItem μ»΄ν¬λ„ŒνŠΈμ˜ icon prop이 React.ReactNode νƒ€μž…μΈμ§€ 확인이 ν•„μš”ν•©λ‹ˆλ‹€. λ‹€μŒ 슀크립트둜 ν™•μΈν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€:

src/entities/create-form/ui/OptionItem/index.tsx (1)

40-40: 내보내기 ꡬ문이 μ μ ˆν•©λ‹ˆλ‹€.

μ»΄ν¬λ„ŒνŠΈμ˜ κΈ°λ³Έ 내보내기가 React μ»¨λ²€μ…˜μ„ 잘 λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€.

Comment on lines +15 to +38
const OptionItem = ({
optionId,
icon,
optionIndex,
register,
remove,
inputName,
}: OptionItemProps) => {
return (
<div key={optionId} className="flex w-full items-center justify-between">
<div className="flex w-full items-center gap-[10px]">
{icon}
<input
{...register(inputName)}
placeholder="λ¬Έμž₯을 μž…λ ₯ν•΄μ£Όμ„Έμš”."
className="w-[60%] text-body4 text-black"
/>
</div>
<button type="button" onClick={() => remove(optionIndex)}>
<XMark />
</button>
</div>
);
};
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

μ ‘κ·Όμ„± κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

μ»΄ν¬λ„ŒνŠΈ κ΅¬μ‘°λŠ” κΉ”λ”ν•˜μ§€λ§Œ, μ ‘κ·Όμ„± μΈ‘λ©΄μ—μ„œ λͺ‡ 가지 κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같은 μˆ˜μ •μ„ μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

 <div key={optionId} className="flex w-full items-center justify-between">
   <div className="flex w-full items-center gap-[10px]">
     {icon}
     <input
       {...register(inputName)}
+      aria-label="μ˜΅μ…˜ μž…λ ₯"
       placeholder="λ¬Έμž₯을 μž…λ ₯ν•΄μ£Όμ„Έμš”."
-      className="w-[60%] text-body4 text-black"
+      className="w-[60%] text-body4 text-black outline-none focus:ring-2 focus:ring-blue-500"
     />
   </div>
   <button 
     type="button" 
     onClick={() => remove(optionIndex)}
+    aria-label="μ˜΅μ…˜ μ‚­μ œ"
+    className="p-2 hover:bg-gray-100 rounded-full transition-colors"
   >
     <XMark />
   </button>
 </div>
πŸ“ 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
const OptionItem = ({
optionId,
icon,
optionIndex,
register,
remove,
inputName,
}: OptionItemProps) => {
return (
<div key={optionId} className="flex w-full items-center justify-between">
<div className="flex w-full items-center gap-[10px]">
{icon}
<input
{...register(inputName)}
placeholder="λ¬Έμž₯을 μž…λ ₯ν•΄μ£Όμ„Έμš”."
className="w-[60%] text-body4 text-black"
/>
</div>
<button type="button" onClick={() => remove(optionIndex)}>
<XMark />
</button>
</div>
);
};
const OptionItem = ({
optionId,
icon,
optionIndex,
register,
remove,
inputName,
}: OptionItemProps) => {
return (
<div key={optionId} className="flex w-full items-center justify-between">
<div className="flex w-full items-center gap-[10px]">
{icon}
<input
{...register(inputName)}
aria-label="μ˜΅μ…˜ μž…λ ₯"
placeholder="λ¬Έμž₯을 μž…λ ₯ν•΄μ£Όμ„Έμš”."
className="w-[60%] text-body4 text-black outline-none focus:ring-2 focus:ring-blue-500"
/>
</div>
<button
type="button"
onClick={() => remove(optionIndex)}
aria-label="μ˜΅μ…˜ μ‚­μ œ"
className="p-2 hover:bg-gray-100 rounded-full transition-colors"
>
<XMark />
</button>
</div>
);
};

@Ethen1264 Ethen1264 merged commit f444ff8 into develop Jan 25, 2025
2 checks passed
@Ethen1264 Ethen1264 deleted the update/form-components branch January 26, 2025 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 Type: Publishing λ””μžμΈ κ΅¬ν˜„
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants