From 66d8d95763174679d0dd351032c60f0d64de3672 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 28 Feb 2025 03:46:26 +0530 Subject: [PATCH] (feat:input) floating input labels --- frontend/src/components/Input.tsx | 35 +++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/Input.tsx b/frontend/src/components/Input.tsx index e703ff14..247446ef 100644 --- a/frontend/src/components/Input.tsx +++ b/frontend/src/components/Input.tsx @@ -1,4 +1,5 @@ import { InputProps } from './types'; +import { useRef } from 'react'; const Input = ({ id, @@ -27,15 +28,19 @@ const Input = ({ thin: 'border', thick: 'border-2', }; + + const inputRef = useRef(null); + return (
{children} - {label && ( -
- - {label} - {required && ( - - * - - )} - -
+ {(label || placeholder) && ( + )}
);