Untitled

mail@pastecode.io avatar
unknown
typescript
a year ago
807 B
3
Indexable
Never
export type RhfTextInputManagerProps =
  | ({
    type: InputTypeEnum.BIG_INPUT
  } & RhfInputTextBigProps)
  | ({
    type: InputTypeEnum.FLOAT
  } & InputTextFloatProps)
  | ({
    type: InputTypeEnum.BOTTOM
  } & InputTextBottomProps)
  | ({
    type: InputTypeEnum.NORMAL
  } & InputTextProps)

export const RhfTextInputManager: React.FC<RhfTextInputManagerProps> = props => {
  const { type } = props

  if (type === InputTypeEnum.NORMAL) {
    return <InputText {...props} />
  }

  if (type === InputTypeEnum.BIG_INPUT) {
    return <RhfInputTextBig {...props} />
  }

  if (type === InputTypeEnum.FLOAT) {
    return <InputTextFloat {...props} />
  }

  if (type === InputTypeEnum.BOTTOM) {
    return <InputTextBottom {...props} />
  }

  return <>PON EL TYPE</>
}