-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reword import and make prop optional
- Loading branch information
1 parent
ec737a5
commit ee3f261
Showing
1 changed file
with
7 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |