"use client"; import { FloatingLabelInputProps } from '#/types'; import React, { useState } from 'react'; import Image from 'next/image'; import { icons } from '#/assets/icons'; export default function FloatingLabelInput({ label, placeholder, type, options, button, showPasswordToggle = false, name, defaultValue, onChange, }: FloatingLabelInputProps) { const [showPassword, setShowPassword] = useState(false); const handleChange = (e: React.ChangeEvent) => { const value = e.target.value; if (onChange) { onChange(value); } }; const renderInput = () => { switch(type) { case 'select': return (
{button &&
{button}
}
); case 'password': return (
{showPasswordToggle && ( )}
); case 'search': return (
{button &&
{button}
}
); default: return (
{button &&
{button}
}
); } }; return (
{renderInput()}
); }