-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YeongseoYoon
committed
Jan 16, 2025
1 parent
e39906a
commit 5cb2f49
Showing
2 changed files
with
45 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Product } from '../../../../types'; | ||
|
||
interface ProductEditFormProps { | ||
product: Product; | ||
onUpdate: <K extends keyof Product>(field: K, value: Product[K]) => void; | ||
} | ||
|
||
export const ProductEditForm = ({ product, onUpdate }: ProductEditFormProps) => { | ||
return ( | ||
<div> | ||
<div className="mb-4"> | ||
<label className="block mb-1">상품명: </label> | ||
<input | ||
type="text" | ||
value={product.name} | ||
onChange={(e) => onUpdate('name', e.target.value)} | ||
className="w-full p-2 border rounded" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label className="block mb-1">가격: </label> | ||
<input | ||
type="number" | ||
value={product.price} | ||
onChange={(e) => onUpdate('price', parseInt(e.target.value))} | ||
className="w-full p-2 border rounded" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label className="block mb-1">재고: </label> | ||
<input | ||
type="number" | ||
value={product.stock} | ||
onChange={(e) => onUpdate('stock', parseInt(e.target.value))} | ||
className="w-full p-2 border rounded" | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; |