feat: 폼 입력 공용 컴포넌트 추가
Co-Authored-By: Claude Opus 5
@2f39258d763ce2ca30dc77170da006d25830020f
+++ components/ui/input.tsx
... | ... | @@ -0,0 +1,16 @@ |
| 1 | +import type { ComponentProps } from "react"; | |
| 2 | + | |
| 3 | +type InputProps = ComponentProps<"input">; | |
| 4 | + | |
| 5 | +/** 기본 텍스트 입력. `readOnly`일 때 배경 톤 + 기본 커서로 편집 불가 상태를 시각 구분한다. */ | |
| 6 | +export function Input({ className, readOnly, ...props }: InputProps) { | |
| 7 | + return ( | |
| 8 | + <input | |
| 9 | + readOnly={readOnly} | |
| 10 | + className={`h-10 w-full rounded-md border border-border px-3 text-body-md text-foreground placeholder:text-foreground-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:pointer-events-none disabled:opacity-50 ${ | |
| 11 | + readOnly ? "cursor-default bg-surface-muted" : "bg-surface" | |
| 12 | + } ${className ?? ""}`} | |
| 13 | + {...props} | |
| 14 | + /> | |
| 15 | + ); | |
| 16 | +} |
+++ components/ui/select.tsx
... | ... | @@ -0,0 +1,13 @@ |
| 1 | +import type { ComponentProps } from "react"; | |
| 2 | + | |
| 3 | +type SelectProps = ComponentProps<"select">; | |
| 4 | + | |
| 5 | +/** 네이티브 `<select>` 래퍼(라이브러리 미사용) — 브라우저 기본 표시(화살표 등)를 그대로 쓴다. */ | |
| 6 | +export function Select({ className, ...props }: SelectProps) { | |
| 7 | + return ( | |
| 8 | + <select | |
| 9 | + className={`h-10 rounded-md border border-border bg-surface px-3 text-body-md text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:pointer-events-none disabled:opacity-50 ${className ?? ""}`} | |
| 10 | + {...props} | |
| 11 | + /> | |
| 12 | + ); | |
| 13 | +} |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?