Skip to content

Commit

Permalink
Update _RenderFormInput.tsx featue Ehancement
Browse files Browse the repository at this point in the history
implementation of Show password functionality
on the auth page
  • Loading branch information
Ktbch authored May 7, 2024
1 parent 7bf3bbe commit ed63b26
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/frontend/components/SchemaForm/_RenderFormInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function RenderFormInput(props: IRenderFormInputProps) {
onChange,
} = useExtendRenderFormInputProps(props);
const { _ } = useLingui();
const isPasswordReveal = useToggle();

Check failure on line 31 in src/frontend/components/SchemaForm/_RenderFormInput.tsx

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'useToggle'.
const formProps = {
label,
required,
Expand Down Expand Up @@ -70,10 +71,37 @@ export function RenderFormInput(props: IRenderFormInputProps) {

switch (type) {
case "email":
case "password":
case "url":
case "color":
return <FormInput type={type} {...formProps} />;
case "password":
return (
<FormInput
type={isPasswordReveal.isOn ? "text" : "password"}

Check failure on line 80 in src/frontend/components/SchemaForm/_RenderFormInput.tsx

View workflow job for this annotation

GitHub Actions / build

Type '"password" | "text"' is not assignable to type '"password" | "email" | "url" | "color"'.
{...formProps}
rightActions={
formProps.input.value
? [
{
systemIcon: "Eye",
action: () => {
isPasswordReveal.toggle();
},
label: msg`show Password`,

Check failure on line 90 in src/frontend/components/SchemaForm/_RenderFormInput.tsx

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'msg'.
},
]
: []
}
input={{
...formProps.input,
onChange: (val) => {
formProps.input.onChange(val);
if (!formProps.input.value) isPasswordReveal.off();
},
}}
/>
);

case "number":
return <FormNumberInput {...formProps} />;

Expand Down

0 comments on commit ed63b26

Please sign in to comment.