Skip to content

Commit a1dea65

Browse files
committed
cp dines
1 parent 6cb5e8f commit a1dea65

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/components/SecretCreatePage.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,11 @@ export const SecretCreatePage = ({
301301
const value = formData[field.key as keyof FormData] as string;
302302
const hasError =
303303
field.key === "value" && validationError === "Value is required";
304-
// Display masked value when not active
305-
const maskedValue = "*".repeat(value.length);
306304
return (
307305
<FormTextInput
308306
key={field.key}
309307
label={field.label}
310-
value={isActive ? value : maskedValue}
308+
value={value}
311309
onChange={(newValue) => {
312310
setFormData({ ...formData, [field.key]: newValue });
313311
if (validationError) {
@@ -318,6 +316,7 @@ export const SecretCreatePage = ({
318316
isActive={isActive}
319317
placeholder="Enter secret value"
320318
error={hasError ? validationError : undefined}
319+
mask="*"
321320
/>
322321
);
323322
}

src/components/form/FormTextInput.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export interface FormTextInputProps {
1616
error?: string;
1717
/** Called when Enter is pressed in the text input */
1818
onSubmit?: () => void;
19+
/** Character to mask input with (e.g., "*" for passwords) */
20+
mask?: string;
1921
}
2022

2123
export const FormTextInput = ({
@@ -26,7 +28,11 @@ export const FormTextInput = ({
2628
placeholder,
2729
error,
2830
onSubmit,
31+
mask,
2932
}: FormTextInputProps) => {
33+
// Display value: use mask character if provided
34+
const displayValue = mask && value ? mask.repeat(value.length) : value;
35+
3036
return (
3137
<FormField label={label} isActive={isActive} error={error}>
3238
{isActive ? (
@@ -35,10 +41,11 @@ export const FormTextInput = ({
3541
onChange={onChange}
3642
placeholder={placeholder}
3743
onSubmit={onSubmit}
44+
mask={mask}
3845
/>
3946
) : (
4047
<Text color={error ? colors.error : colors.text}>
41-
{value || "(empty)"}
48+
{displayValue || "(empty)"}
4249
</Text>
4350
)}
4451
</FormField>

0 commit comments

Comments
 (0)