Skip to content

Commit

Permalink
fix: reword import and make prop optional
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-aiello-appfolio committed Jan 2, 2024
1 parent ec737a5 commit ee3f261
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/components/Input/MaskedInput.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import React, { FC } from 'react';
import MaskedInputBase, { MaskedInputProps as RTMaskedInputProps } from 'react-text-mask';

export interface MaskedInputProps extends RTMaskedInputProps {
'data-testid': string;
interface MaskedInputProps extends RTMaskedInputProps {
'data-testid'?: string;
}

const MaskedInput: FC<MaskedInputProps> = ({
guide = false,
'data-testid': dataTestId,
...props
}) => {
dataTestId = dataTestId || 'react-gears-masked-input';

return (
<MaskedInputBase className="form-control" guide={guide} data-testid={dataTestId} {...props} />
);
const MaskedInput: FC<MaskedInputProps> = ({ guide = false, ...props }) => {
if (props && !props['data-testid']) {
props['data-testid'] = 'react-gears-maskedinput';
}
return <MaskedInputBase className="form-control" guide={guide} {...props} />;
};

export default MaskedInput;

0 comments on commit ee3f261

Please sign in to comment.