* feat: update landing page * feat: Add favicon and SEO (JSON-LD schema, meta tags) - Add favicon image - Add JSON-LD schema for Hackathon event - Add react-helmet-async for managing meta tags * chore: remove react-helmet-async * chore: update landing page * chore: update UI for signup and login - add back button for better UX * feat: add image loading state and skeleton UI for team dashboard * fix: landing navbar not sticky to top, fix onboarding UI * feat(hackathon): update UI - Update dashboard, onboarding user, edit profile, and team layout to make it more consistent * fix: optimize placeholder banner image & minor fix dark mode --------- Co-authored-by: Maulana Sodiqin <sodiqincahyana1@gmail.com> Co-authored-by: Muhammad Zakir Ramadhan <61570975+zakirkun@users.noreply.github.com>
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import {
|
|
InputField,
|
|
TInputFieldProps,
|
|
} from '@imphnen-frontend-service/ui/molecules';
|
|
import {
|
|
FieldValues,
|
|
useController,
|
|
UseControllerProps,
|
|
} from 'react-hook-form';
|
|
|
|
export type TControlledInputFieldProps<T extends FieldValues> =
|
|
UseControllerProps<T> & TInputFieldProps;
|
|
|
|
export const ControlledInputField = <T extends FieldValues>(
|
|
props: TControlledInputFieldProps<T>
|
|
) => {
|
|
const { field, fieldState } = useController<T>(props);
|
|
|
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
let value;
|
|
|
|
if (props.type === 'number') {
|
|
value = Number(e.target.value);
|
|
} else if (props.type === 'file') {
|
|
value = e.target.files?.[0];
|
|
} else {
|
|
value = e.target.value;
|
|
}
|
|
field.onChange(value);
|
|
};
|
|
|
|
const inputProps =
|
|
props.type === 'file'
|
|
? { ...props, ...field, value: undefined }
|
|
: { ...props, ...field };
|
|
|
|
return (
|
|
<InputField
|
|
error={fieldState.error?.message}
|
|
{...inputProps}
|
|
onChange={handleChange}
|
|
isRequired={props.isRequired}
|
|
size={props.size}
|
|
/>
|
|
);
|
|
};
|