2024-10-09 16:59:04 +08:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faClose } from "@fortawesome/free-solid-svg-icons";
|
|
|
|
// import styles from "./index.module.scss";
|
|
|
|
export default function OwnInput({
|
|
|
|
value,
|
|
|
|
onChange,
|
|
|
|
type = "text",
|
|
|
|
name,
|
|
|
|
placeholder,
|
|
|
|
clearable,
|
|
|
|
disabled,
|
2024-10-22 17:24:02 +08:00
|
|
|
className,
|
2024-10-24 21:28:49 +08:00
|
|
|
inputClassName,
|
2024-10-23 13:52:52 +08:00
|
|
|
fontSize,
|
2024-10-09 16:59:04 +08:00
|
|
|
}) {
|
|
|
|
return (
|
2024-10-22 17:24:02 +08:00
|
|
|
<div className={`flex flex-1 relative ${className}`}>
|
2024-10-09 16:59:04 +08:00
|
|
|
<input
|
|
|
|
placeholder={placeholder}
|
|
|
|
disabled={disabled}
|
|
|
|
name={name}
|
|
|
|
type={type}
|
|
|
|
maxLength={11}
|
|
|
|
onChange={(e) => onChange(e.target?.value)}
|
|
|
|
value={value}
|
2024-10-24 21:28:49 +08:00
|
|
|
className={`w-full placeholder:text-[#FFFFFF80] ${inputClassName}`}
|
2024-10-23 13:52:52 +08:00
|
|
|
style={{ fontSize: `${fontSize || 16}px` }}
|
2024-10-09 16:59:04 +08:00
|
|
|
/>
|
|
|
|
{clearable && value != "" && (
|
|
|
|
<div className="w-4 h-4 absolute right-2 top-[2px] flex justify-center items-center bg-[#ffffff33] p-1 rounded-full">
|
|
|
|
<FontAwesomeIcon
|
|
|
|
color="#ffffff40"
|
|
|
|
icon={faClose}
|
|
|
|
style={{ maxWidth: "12px" }}
|
|
|
|
onClick={() => {
|
|
|
|
onChange && onChange("");
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|