-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: added fixes according to feedback from pr review
- Loading branch information
1 parent
5e5b369
commit fdead54
Showing
4 changed files
with
120 additions
and
25 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
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
33 changes: 27 additions & 6 deletions
33
app/component-library/components/Texts/SensitiveText/SensitiveText.tsx
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
45 changes: 37 additions & 8 deletions
45
app/component-library/components/Texts/SensitiveText/SensitiveText.types.ts
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,14 +1,43 @@ | ||
// external dependencies | ||
// External dependencies. | ||
import { TextProps } from '../Text/Text.types'; | ||
|
||
export enum SensitiveLengths { | ||
Short = 7, | ||
Medium = 9, | ||
Long = 13, | ||
} | ||
/** | ||
* SensitiveText length options. | ||
*/ | ||
export const SensitiveTextLength = { | ||
Short: '7', | ||
Medium: '9', | ||
Long: '13', | ||
} as const; | ||
|
||
/** | ||
* Type for SensitiveTextLength values. | ||
*/ | ||
export type SensitiveTextLengthType = | ||
(typeof SensitiveTextLength)[keyof typeof SensitiveTextLength]; | ||
|
||
/** | ||
* Type for custom length values. | ||
*/ | ||
export type CustomLength = string; | ||
|
||
/** | ||
* SensitiveText component props. | ||
*/ | ||
export interface SensitiveTextProps extends TextProps { | ||
isHidden: boolean; | ||
length: SensitiveLengths; | ||
/** | ||
* Boolean to determine whether the text should be hidden or visible. | ||
* @default false | ||
*/ | ||
isHidden?: boolean; | ||
/** | ||
* Determines the length of the hidden text (number of asterisks). | ||
* Can be a predefined SensitiveTextLength or a custom string number. | ||
* @default SensitiveTextLength.Short | ||
*/ | ||
length?: SensitiveTextLengthType | CustomLength; | ||
/** | ||
* The text content to be displayed or hidden. | ||
*/ | ||
children: string; | ||
} |