quick hide input

This commit is contained in:
2023-07-13 19:31:52 +08:00
parent ab5eab1a9b
commit 08c087468b

View File

@@ -71,10 +71,19 @@ const Input = (props: {
field: "apiKey" | "apiEndpoint"; field: "apiKey" | "apiEndpoint";
help: string; help: string;
}) => { }) => {
const [hideInput, setHideInput] = useState(false);
return ( return (
<Help help={props.help}> <Help help={props.help}>
<label className="m-2 p-2">{props.field}</label> <label className="m-2 p-2">{props.field}</label>
<span
className="m-2 p-2"
onClick={(event: any) => setHideInput(!hideInput)}
>
<label>hide</label>
<input type="checkbox" checked={hideInput} />
</span>
<input <input
type={hideInput ? "password" : "text"}
className="m-2 p-2 border rounded focus w-32 md:w-fit" className="m-2 p-2 border rounded focus w-32 md:w-fit"
value={props.chatStore[props.field]} value={props.chatStore[props.field]}
onChange={(event: any) => { onChange={(event: any) => {