Server IP : 172.67.214.6 / Your IP : 216.73.216.73 Web Server : LiteSpeed System : Linux premium900.web-hosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : redwjova ( 1790) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/redwjova/near.llc/wp-content/plugins/extendify/src/HelpCenter/components/ai-chat/ |
Upload File : |
import { useRef, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { Icon } from '@wordpress/icons'; import { DynamicTextarea } from '@help-center/components/ai-chat/DynamicTextarea'; import { send } from '@help-center/components/ai-chat/icons'; export const Question = ({ onSubmit }) => { const [inputValue, setInputValue] = useState(''); const formRef = useRef(null); const handleInputChange = (e) => { setInputValue(e.target.value); }; const handleKeyDown = (e) => { if (e.key === 'Enter' && !e.shiftKey) { formRef?.current?.requestSubmit(); } }; return ( <form onSubmit={onSubmit} ref={formRef} className="rtl:w-full"> <p className="m-0 mb-1 text-lg font-medium opacity-80"> {__('Hi there!', 'extendify-local')} </p> <p className="m-0 mb-6 text-2xl font-medium"> {__('Ask me any questions about WordPress.', 'extendify-local')} </p> <div className="relative rounded border border-gray-300 bg-white shadow"> <DynamicTextarea value={inputValue} className="rtl:pl-auto h-full w-full flex-1 resize-none py-4 pl-3 pr-10 placeholder-gray-600 rtl:py-2.5 rtl:pr-2" placeholder={__('Ask your WordPress question…', 'extendify-local')} onChange={handleInputChange} onKeyDown={handleKeyDown} /> <button type="submit" className="absolute bottom-3.5 right-2.5 flex h-6 cursor-pointer items-center border-none bg-transparent fill-current text-gray-700 hover:text-gray-900 rtl:bottom-2 rtl:left-2.5 rtl:right-auto" disabled={!inputValue}> <Icon icon={send} className="h-4 w-4" /> </button> </div> </form> ); };