Skip to content

Commit

Permalink
convert React Input component to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo Cherblanc authored and Lucanis committed Jan 17, 2024
1 parent 6c1d1e4 commit 0dd4dd1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { forwardRef, useState } from 'react';
import React, { Ref, forwardRef, useState } from 'react';

import Error from '../Error';
import { ReactComponent as EyeIcon } from '@icons/eye.svg';
import { InputProps } from './Input.types';

const Input = forwardRef(
(
Expand All @@ -16,8 +17,8 @@ const Input = forwardRef(
placeholder,
value,
...props
},
ref
}: InputProps,
ref: Ref<HTMLInputElement>
) => {
const [passwordVisible, setPasswordVisible] = useState(false);

Expand Down
14 changes: 14 additions & 0 deletions templates/frontOffice/modern/components/React/Input/Input.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { InputHTMLAttributes } from 'react';

export type InputProps = {
label: string;
name: string;
type?: string;
error?: any;
labelClassname?: string;
className?: string;
transformValue: (
value: InputHTMLAttributes<HTMLInputElement>['value']
) => string | InputHTMLAttributes<HTMLInputElement>['value'];
placeholder?: string;
} & InputHTMLAttributes<HTMLInputElement>;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Input';

0 comments on commit 0dd4dd1

Please sign in to comment.