Browse Source

laanc 공통 컴포넌트 수정

master
박상현 8 months ago
parent
commit
99abae6176
  1. 6
      src/components/laanc/step/LaancStep1.js
  2. 62
      src/components/ui/input/index.tsx

6
src/components/laanc/step/LaancStep1.js

@ -1086,7 +1086,7 @@ export default function LaancStep1({
.replace('m') // "m"을 맨 뒤에 붙임 .replace('m') // "m"을 맨 뒤에 붙임
}); });
}} }}
innerRef={fltElevRef} // Input 요소에 ref를 연결 ref={fltElevRef} // Input 요소에 ref를 연결
onClick={() => handleInputClick('fltElev')} onClick={() => handleInputClick('fltElev')}
placeholder='100m' placeholder='100m'
/> />
@ -1118,8 +1118,8 @@ export default function LaancStep1({
// value.replace(/^0+/, '').replace(/\D/g, '') // value.replace(/^0+/, '').replace(/\D/g, '')
// ); // );
}} }}
innerRef={bufferZoneRef} // Input 요소에 ref를 연결 ref={bufferZoneRef} // Input 요소에 ref를 연결
onClick={() => handleInputClick('bufferZone')} onClick={e => handleInputClick('bufferZone')}
placeholder='100m' placeholder='100m'
disabled={ disabled={
!areaCoordList !areaCoordList

62
src/components/ui/input/index.tsx

@ -1,5 +1,10 @@
'use client'; import {
import { ChangeEvent, MouseEventHandler, ReactNode } from 'react'; ChangeEvent,
MouseEventHandler,
ReactNode,
ForwardedRef,
forwardRef
} from 'react';
import { Input } from 'reactstrap'; import { Input } from 'reactstrap';
interface Props { interface Props {
@ -18,29 +23,13 @@ interface Props {
bsSize?: 'lg' | 'sm' | undefined; bsSize?: 'lg' | 'sm' | undefined;
placeholder?: string; placeholder?: string;
disabled?: boolean; disabled?: boolean;
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void; onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
} }
/**
*
* @param children: ReactNode
* @param className?:string
* @param readOnly?:boolean default false
* @param checked?:boolean
* @param label?:string
* @param id?:string
* @param onClick?:MouseEventHandler<HTMLButtonElement>
* @param onChange?:MouseEventHandler<HTMLButtonElement>
* @param value?:any
* @param name?:string
* @param type?:string
* @param inline?:boolean default false
* @param bsSize?: "lg" | "sm"
* @param placeholder?:string
* @param onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
* @param disabled?:boolean default false
*/
export default function CustomInput({ const CustomInput = forwardRef<HTMLInputElement, Props>(
(
{
children, children,
className, className,
label, label,
@ -52,32 +41,39 @@ export default function CustomInput({
value, value,
name, name,
type, type,
inline = false, inline,
bsSize, bsSize,
placeholder, placeholder,
disabled = false, disabled = false,
onKeyPress onKeyPress,
}: Props) { onBlur
},
ref
) => {
return ( return (
<>
<Input <Input
innerRef={ref}
className={className} className={className}
id={id} label={label}
checked={checked} checked={checked}
readOnly={readOnly} readOnly={readOnly}
label={label} id={id}
onClick={onClick}
onChange={onChange}
value={value} value={value}
name={name} name={name}
disabled={disabled}
type={type} type={type}
inline={inline}
bsSize={bsSize} bsSize={bsSize}
onClick={onClick}
onChange={onChange}
onKeyPress={onKeyPress}
placeholder={placeholder} placeholder={placeholder}
disabled={disabled}
onBlur={onBlur}
onKeyPress={onKeyPress}
> >
{children} {children}
</Input> </Input>
</>
); );
} }
);
export default CustomInput;

Loading…
Cancel
Save