Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion src/app/(protected)/_components/modal/word/ModalBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type ModalBodyProps = {
| "usage"
| "memo"
| "bookmarked",
value: string
value: string,
) => void;

form: WordCreateInput | WordUpdateInput;
Expand All @@ -36,6 +36,7 @@ export default function ModalBody({
<>
<ModalField label="단어*">
<Input
autoFocus
name={form.expression || ""}
value={form.expression || ""}
onChange={(e) => updateField("expression", e.target.value)}
Expand Down
7 changes: 5 additions & 2 deletions src/components/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type InputProps = {
placeholder?: string;
className?: string;
errors?: string;
autoFocus?: boolean;
};

export default function Input({
Expand All @@ -25,11 +26,13 @@ export default function Input({
onClick,
errors,
className,
autoFocus,
}: InputProps) {
return (
<div className="w-full">
<div className="relative">
<input
autoFocus={autoFocus}
id={id}
name={name}
type={type}
Expand All @@ -41,15 +44,15 @@ export default function Input({
errors
? "border border-red-500 focus:ring-2 focus:ring-red-500"
: "border border-gray-100 focus:ring-2 shadow-md focus:ring-gray-900",
className
className,
)}
/>
<button
onClick={onClick}
type="button"
className={clsx(
"absolute right-5 top-1/2 -translate-y-1/2",
errors ? "text-red-500" : "text-black"
errors ? "text-red-500" : "text-black",
)}
>
{children}
Expand Down