Dom Sip c11b1ca868
refactor: SOL-122: replace classnames with clsx (#656)
refactor: SOL-122: replace classnames with clsx
2022-02-08 11:53:32 -05:00

38 lines
804 B
TypeScript

import cn from 'clsx'
import s from './Input.module.css'
import React, { InputHTMLAttributes } from 'react'
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
className?: string
onChange?: (...args: any[]) => any
}
const Input: React.FC<InputProps> = (props) => {
const { className, children, onChange, ...rest } = props
const rootClassName = cn(s.root, {}, className)
const handleOnChange = (e: any) => {
if (onChange) {
onChange(e.target.value)
}
return null
}
return (
<label>
<input
className={rootClassName}
onChange={handleOnChange}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
spellCheck="false"
{...rest}
/>
</label>
)
}
export default Input