Fixed padding and disable copy and paste on chat input

This commit is contained in:
Lucas Oliveira 2023-05-22 20:01:26 -03:00
commit 2b6b790f4a

View file

@ -1,6 +1,7 @@
import { LockClosedIcon, PaperAirplaneIcon } from "@heroicons/react/24/outline"; import { LockClosedIcon, PaperAirplaneIcon } from "@heroicons/react/24/outline";
import { classNames } from "../../../utils"; import { classNames } from "../../../utils";
import { useEffect, useRef, useState } from "react"; import { useContext, useEffect, useRef, useState } from "react";
import { TabsContext } from "../../../contexts/tabsContext";
export default function ChatInput({ export default function ChatInput({
lockChat, lockChat,
@ -16,6 +17,8 @@ export default function ChatInput({
} }
}, [chatValue]); }, [chatValue]);
const { setDisableCP } = useContext(TabsContext);
return ( return (
<div className="relative"> <div className="relative">
<textarea <textarea
@ -24,6 +27,12 @@ export default function ChatInput({
sendMessage(); sendMessage();
} }
}} }}
onBlur={() => {
setDisableCP(false)
}}
onFocus={() => {
setDisableCP(true)
}}
rows={1} rows={1}
ref={inputRef} ref={inputRef}
disabled={lockChat} disabled={lockChat}
@ -49,7 +58,7 @@ export default function ChatInput({
)} )}
placeholder={"Send a message..."} placeholder={"Send a message..."}
/> />
<div className="absolute bottom-1 right-3"> <div className="absolute bottom-0.5 right-3">
<button disabled={lockChat} onClick={() => sendMessage()}> <button disabled={lockChat} onClick={() => sendMessage()}>
{lockChat ? ( {lockChat ? (
<LockClosedIcon <LockClosedIcon