diff --git a/src/utils/IconInput.tsx b/src/utils/IconInput.tsx index 7afe0416..9b0e45d4 100644 --- a/src/utils/IconInput.tsx +++ b/src/utils/IconInput.tsx @@ -2,25 +2,27 @@ import type { IconProp } from '@fortawesome/fontawesome-svg-core'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import classNames from 'classnames'; import type { FC } from 'react'; -import { useRef } from 'react'; import type { InputProps } from 'reactstrap'; import { Input } from 'reactstrap'; +import { useElementRef } from './helpers/hooks'; import './IconInput.scss'; -type IconInputProps = InputProps & { icon: IconProp }; +type IconInputProps = InputProps & { + icon: IconProp; +}; export const IconInput: FC = ({ icon, className, ...rest }) => { - const ref = useRef<{ input: HTMLInputElement }>(); + const ref = useElementRef(); const classes = classNames('icon-input-container__input', className); return (
- + ref.current?.input.focus()} + onClick={() => ref.current?.focus()} />
);