Skip to content

Conversation

@Greensod-96
Copy link
Contributor

@Greensod-96 Greensod-96 commented Jan 1, 2026

๐ŸŽฏ ์ž‘์—… ๋‚ด์šฉ

  • ๊ณตํ†ต Input ์ปดํฌ๋„ŒํŠธ ๊ตฌ์กฐ ์ •๋ฆฌ ๋ฐ ๋ฆฌํŒฉํ† ๋ง
  • InputField, PasswordInput, SearchInput ์—ญํ•  ๋ถ„๋ฆฌ ๋ฐ ์ฑ…์ž„ ๋ช…ํ™•ํ™”
  • ์ค‘๋ณต๋œ ์Šคํƒ€์ผ ์ œ๊ฑฐ ๋ฐ ๊ณตํ†ต ์Šคํƒ€์ผ ํ†ตํ•ฉ
  • props ๊ตฌ์กฐ ๋‹จ์ˆœํ™”๋กœ ์‚ฌ์šฉ์„ฑ ๊ฐœ์„ 

โœ… ์ฒดํฌ๋ฆฌ์ŠคํŠธ

  • ์ฝ”๋“œ ๋ฆฌ๋ทฐ ์š”์ฒญ
  • ํ…Œ์ŠคํŠธ ์™„๋ฃŒ
  • ๋ฌธ์„œ ์—…๋ฐ์ดํŠธ

๐Ÿ“ธ ์Šคํฌ๋ฆฐ์ƒท (์„ ํƒ์‚ฌํ•ญ)

(ํ•„์š” ์‹œ ํ™”๋ฉด ์บก์ฒ˜ ์ฒจ๋ถ€)

๐Ÿ’ฌ ์ถ”๊ฐ€ ์„ค๋ช…

  • ๊ธฐ์กด์— ๋ถ„์‚ฐ๋˜์–ด ์žˆ๋˜ Input ๊ด€๋ จ ์Šคํƒ€์ผ๊ณผ ๋กœ์ง์„ ๊ณตํ†ต Input ์ปดํฌ๋„ŒํŠธ ๊ธฐ์ค€์œผ๋กœ ์ •๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๋ถˆํ•„์š”ํ•œ props(className ๋“ฑ)๋ฅผ ์ œ๊ฑฐํ•˜๊ณ , ์‚ฌ์šฉ ์‹œ ์ผ๊ด€๋œ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์œ ์ง€ํ•˜๋„๋ก ๊ฐœ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์—ญํ• ๋ณ„ ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ๋ฅผ ํ†ตํ•ด ํ™•์žฅ์„ฑ๊ณผ ์œ ์ง€๋ณด์ˆ˜์„ฑ์„ ๋†’์˜€์Šต๋‹ˆ๋‹ค.
  • ํ–ฅํ›„ ์ƒˆ๋กœ์šด ์ž…๋ ฅ ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ ์‹œ์—๋„ ์ผ๊ด€๋œ ๊ตฌ์กฐ๋กœ ํ™•์žฅ ๊ฐ€๋Šฅํ•˜๋„๋ก ์„ค๊ณ„ํ–ˆ์Šต๋‹ˆ๋‹ค.

@Greensod-96 Greensod-96 self-assigned this Jan 1, 2026
@seongihun
Copy link
Contributor

/gemini-code-assist ์ฝ”๋“œ ๋ฆฌ๋ทฐ

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

์ „๋ฐ˜์ ์œผ๋กœ Input ์ปดํฌ๋„ŒํŠธ๋“ค์„ ๋ฆฌํŒฉํ† ๋งํ•˜์—ฌ ๊ตฌ์กฐ๋ฅผ ์ •๋ฆฌํ•˜๊ณ  ์žฌ์‚ฌ์šฉ์„ฑ์„ ๋†’์ธ ์ข‹์€ PR์ž…๋‹ˆ๋‹ค. ํŠนํžˆ InputField์—์„œ useId๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ ‘๊ทผ์„ฑ์„ ๊ฐœ์„ ํ•˜๊ณ , PasswordInput์— aria ์†์„ฑ์„ ์ถ”๊ฐ€ํ•œ ์ ์ด ์ธ์ƒ์ ์ž…๋‹ˆ๋‹ค. ์ฝ”๋“œ ์ „๋ฐ˜์— ๊ฑธ์ณ ์ผ๊ด€๋œ ๊ตฌ์กฐ๋ฅผ ์ ์šฉํ•˜๋ ค๋Š” ๋…ธ๋ ฅ์ด ๋‹๋ณด์ž…๋‹ˆ๋‹ค.

๋‹ค๋งŒ, ๋ช‡ ๊ฐ€์ง€ ๊ฐœ์„ ์ ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค.

  • Input ์ปดํฌ๋„ŒํŠธ๋Š” forwardRef๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ๋ฆฌํŒฉํ† ๋งํ•˜์—ฌ React์˜ ํ‘œ์ค€ ref ์ „๋‹ฌ ๋ฐฉ์‹์„ ๋”ฐ๋ฅด๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.
  • InputField ์ปดํฌ๋„ŒํŠธ๊ฐ€ children prop์„ ๋ฐ›์„ ๋•Œ, id๋‚˜ ์—๋Ÿฌ ์Šคํƒ€์ผ๋ง๊ณผ ๊ฐ™์€ ์ค‘์š”ํ•œ props๋ฅผ ์ „๋‹ฌํ•˜์ง€ ์•Š๋Š” ์‹ฌ๊ฐํ•œ ๋ฒ„๊ทธ๊ฐ€ ์žˆ์–ด ์ˆ˜์ •์„ ์ œ์•ˆํ–ˆ์Šต๋‹ˆ๋‹ค.
  • PasswordInput์˜ ์•„์ด์ฝ˜ alt ํ…์ŠคํŠธ๋ฅผ ์ œ๊ฑฐํ•˜์—ฌ ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์‚ฌ์šฉ์ž์—๊ฒŒ ์ค‘๋ณต๋œ ์ •๋ณด๊ฐ€ ์ฝํžˆ์ง€ ์•Š๋„๋ก ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž์„ธํ•œ ๋‚ด์šฉ์€ ๊ฐ ํŒŒ์ผ์— ๋‚จ๊ธด ์ฝ”๋ฉ˜ํŠธ๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”.

Comment on lines +30 to +41
{children ?? (
<Input
id={id}
{...props}
className={clsx(
error
? "border-red-500 focus:ring-red-500"
: "border-gray-200 focus:ring-primary-500",
className
)}
/>
)}

Choose a reason for hiding this comment

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

critical

children prop์„ ์‚ฌ์šฉํ•  ๋•Œ, id, ...props ๋ฐ ์—๋Ÿฌ ์ƒํƒœ์— ๋”ฐ๋ฅธ className์ด children์œผ๋กœ ์ „๋‹ฌ๋˜์ง€ ์•Š์•„ label๊ณผ input์˜ ์—ฐ๊ฒฐ์ด ๋Š์–ด์ง€๊ณ  ์—๋Ÿฌ ์Šคํƒ€์ผ๋ง ๋ฐ react-hook-form ์—ฐ๋™์ด ๋™์ž‘ํ•˜์ง€ ์•Š๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์ ‘๊ทผ์„ฑ๊ณผ ์ปดํฌ๋„ŒํŠธ์˜ ํ•ต์‹ฌ ๊ธฐ๋Šฅ์„ ์ €ํ•ดํ•˜๋Š” ์‹ฌ๊ฐํ•œ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. React.cloneElement๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ children์—๊ฒŒ ํ•„์š”ํ•œ props๋ฅผ ์ฃผ์ž…ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ import { useId, ReactNode, cloneElement } from "react";์™€ ๊ฐ™์ด cloneElement๋ฅผ importํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

      {children ? (
        cloneElement(children as React.ReactElement, {
          id,
          ...props,
          className: clsx(
            error
              ? "border-red-500 focus:ring-red-500"
              : "border-gray-200 focus:ring-primary-500",
            (children as React.ReactElement).props.className,
            className
          ),
        })
      ) : (
        <Input
          id={id}
          {...props}
          className={clsx(
            error
              ? "border-red-500 focus:ring-red-500"
              : "border-gray-200 focus:ring-primary-500",
            className
          )}
        />
      )}

Comment on lines +4 to 19
type InputProps = ComponentProps<"input"> & {
inputRef?: React.Ref<HTMLInputElement>;
};

export function Input({ className, inputRef, ...props }: InputProps) {
return (
<input {...props} className={clsx("border rounded px-3 py-2", className)} />
<input
ref={inputRef}
{...props}
className={clsx(
"h-[54px] w-full rounded-[16px] border px-[20px] text-sm outline-none",
className
)}
/>
);
}

Choose a reason for hiding this comment

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

medium

inputRef prop์„ ์‚ฌ์šฉํ•˜๋Š” ๋Œ€์‹  React.forwardRef๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ref๋ฅผ ์ง์ ‘ ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ์ด ๋” ์ผ๋ฐ˜์ ์ธ React ํŒจํ„ด์ด๋ฉฐ, ์ปดํฌ๋„ŒํŠธ์˜ ์žฌ์‚ฌ์šฉ์„ฑ๊ณผ ๊ฐ€๋…์„ฑ์„ ๋†’์ž…๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ถ€๋ชจ ์ปดํฌ๋„ŒํŠธ์—์„œ useRef๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ๋” ์ง๊ด€์ ์œผ๋กœ ref๋ฅผ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. import { ComponentProps, forwardRef } from "react";์™€ ๊ฐ™์ด forwardRef๋ฅผ importํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Suggested change
type InputProps = ComponentProps<"input"> & {
inputRef?: React.Ref<HTMLInputElement>;
};
export function Input({ className, inputRef, ...props }: InputProps) {
return (
<input {...props} className={clsx("border rounded px-3 py-2", className)} />
<input
ref={inputRef}
{...props}
className={clsx(
"h-[54px] w-full rounded-[16px] border px-[20px] text-sm outline-none",
className
)}
/>
);
}
export const Input = forwardRef<HTMLInputElement, ComponentProps<"input">>(
({ className, ...props }, ref) => {
return (
<input
ref={ref}
{...props}
className={clsx(
"h-[54px] w-full rounded-[16px] border px-[20px] text-sm outline-none",
className
)}
/>
);
}
);
Input.displayName = "Input";

<Image
src={visible ? "/icon_active_on.svg" : "/icon_active_off.svg"}
alt={visible ? "๋น„๋ฐ€๋ฒˆํ˜ธ ์ˆจ๊ธฐ๊ธฐ" : "๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณด๊ธฐ"}
alt={visible ? "๋น„๋ฐ€๋ฒˆํ˜ธ ์ˆจ๊ธฐ๊ธฐ ์•„์ด์ฝ˜" : "๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณด๊ธฐ ์•„์ด์ฝ˜"}

Choose a reason for hiding this comment

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

medium

๋ฒ„ํŠผ์— aria-label์ด ์ด๋ฏธ "๋น„๋ฐ€๋ฒˆํ˜ธ ์ˆจ๊ธฐ๊ธฐ" / "๋น„๋ฐ€๋ฒˆํ˜ธ ํ‘œ์‹œ"๋กœ ๋ช…ํ™•ํ•˜๊ฒŒ ์„ค์ •๋˜์–ด ์žˆ์œผ๋ฏ€๋กœ, ๋‚ด๋ถ€์— ์žˆ๋Š” ์•„์ด์ฝ˜์€ ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์‚ฌ์šฉ์ž์—๊ฒŒ ์ค‘๋ณต๋œ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฐ ๊ฒฝ์šฐ, ์žฅ์‹์šฉ ์ด๋ฏธ์ง€๋กœ ์ทจ๊ธ‰ํ•˜์—ฌ alt ์†์„ฑ์„ ๋นˆ ๋ฌธ์ž์—ด("")๋กœ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ด ์ ‘๊ทผ์„ฑ ๋ชจ๋ฒ” ์‚ฌ๋ก€์ž…๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์Šคํฌ๋ฆฐ ๋ฆฌ๋”๊ฐ€ ์•„์ด์ฝ˜์„ ๋ถˆํ•„์š”ํ•˜๊ฒŒ ์ฝ์ง€ ์•Š๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

Suggested change
alt={visible ? "๋น„๋ฐ€๋ฒˆํ˜ธ ์ˆจ๊ธฐ๊ธฐ ์•„์ด์ฝ˜" : "๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณด๊ธฐ ์•„์ด์ฝ˜"}
alt=""

@Greensod-96 Greensod-96 merged commit a18a794 into develop Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants