'use client'; // --------------------------------------------------------------------------------------------------------------------- //! Imports // --------------------------------------------------------------------------------------------------------------------- // ------------------------------------------------------ React -------------------------------------------------------- import { FormEvent } from 'react'; // --------------------------------------------------------------------------------------------------------------------- // ------------------------------------------------- Assets & Styles --------------------------------------------------- import CheckIcon from '@/assets/CheckIcon'; import CloseIcon from '@/assets/CloseIcon'; import './styles.scss'; // --------------------------------------------------------------------------------------------------------------------- const InlineInput = ({ label = '', name = '', type = 'text', placeholder = '', defaultValue = '', autoComplete = 'off', onSubmit = (value?: string) => {}, }) => { const handleSubmit = (ev: FormEvent) => { ev.preventDefault(); if (!ev.currentTarget.reportValidity()) { return; } const formData = new FormData(ev.currentTarget); const value = formData.get(name); onSubmit(value ? value.toString() : null); }; return (
); }; export default InlineInput;