From 61c54e190f8991ed044c7e6aae02cb020942e599 Mon Sep 17 00:00:00 2001 From: qkdflrgs Date: Fri, 4 Aug 2023 11:46:26 +0900 Subject: [PATCH] =?UTF-8?q?refactor/#67:=20=EC=9E=85=EB=A0=A5=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EC=97=90=20=ED=8C=A8=EC=8A=A4?= =?UTF-8?q?=EC=9B=8C=EB=93=9C=20=ED=83=80=EC=9E=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FE/src/components/common/Input/Input.tsx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/FE/src/components/common/Input/Input.tsx b/FE/src/components/common/Input/Input.tsx index ac5dd39ed..74a836d82 100644 --- a/FE/src/components/common/Input/Input.tsx +++ b/FE/src/components/common/Input/Input.tsx @@ -2,31 +2,42 @@ import { styled } from "styled-components"; type Props = { id?: string; + inputType?: "text" | "password"; placeholder?: string; handleFocus?(): void; handleBlur?(): void; - updateInputValue?(value: string): void; + onChange?(e: React.ChangeEvent): void; + value?: string; + handleEnterFilter?(): void; }; export default function Input({ id, + inputType = "text", placeholder, handleFocus, handleBlur, - updateInputValue, + onChange, + value, + handleEnterFilter, }: Props) { - const handleInputChange = (e: React.ChangeEvent) => { - updateInputValue!(e.target.value); + const enterKeyPress = (e: React.KeyboardEvent) => { + if (e.key === "Enter") { + e.preventDefault(); + handleEnterFilter && handleEnterFilter(); + } }; return ( ); }