;
+ height: number;
+ textSize: string;
+ iconSize: { w: number; h: number };
+ }
+> = {
+ lg: {
+ widthMap: { long: 640, short: 400 },
+ height: 70,
+ textSize: "text-[16px] placeholder:text-[16px]",
+ iconSize: { w: 24, h: 24 },
+ },
+ md: {
+ widthMap: { long: 440, short: 360 },
+ height: 55,
+ textSize: "text-[14px] placeholder:text-[14px]",
+ iconSize: { w: 22, h: 22 },
+ },
+ sm: {
+ widthMap: { long: 335, short: 335 },
+ height: 55,
+ textSize: "text-[14px] placeholder:text-[14px]",
+ iconSize: { w: 22, h: 22 },
+ },
+};
+
+export const TextField = ({
+ fieldSize = "lg",
+ widthSize = "long",
+ isError = false,
+ isHiddenable = false,
+ className,
+ ...rest
+} : TextFieldProps) => {
+ const [text, setText] = useState("");
+ const [focused, setFocused] = useState(false);
+ const [hidden, setHidden] = useState(isHiddenable); //비밀번호 시 숨겨진 상태로 시작
- const [text, setText] = useState("");
- const [focused, setFocused] = useState(false);
+ const { widthMap, height, textSize, iconSize} = styleMap[fieldSize];
+ const width = widthMap[widthSize];
- return (
+ return (
{
setText(e.target.value);
- props.onChange?.(e);
+ rest.onChange?.(e); //text 수정 시 handling
}}
- className={`flex-1 bg-transparent outline-none text-[20px] ${
- "text-white"
- }`}
+ className={cn(
+ textSize,
+ "flex-1 bg-transparent outline-none text-white",
+ className
+ )}
onFocus={(e) => {
setFocused(true);
- props.onFocus?.(e);
}}
onBlur={(e) => {
setFocused(false);
- props.onBlur?.(e);
}}
/>
+
+ {isHiddenable && (
+
+ )}
);
};
\ No newline at end of file