diff --git a/src/components/messenger/feed/components/create-post/index.tsx b/src/components/messenger/feed/components/create-post/index.tsx deleted file mode 100644 index e7daed194..000000000 --- a/src/components/messenger/feed/components/create-post/index.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { useEffect, useRef, useState } from 'react'; - -import { motion, AnimatePresence } from 'framer-motion'; -import { Avatar, Button } from '@zero-tech/zui/components'; - -import { Key } from '../../../../../lib/keyboard-search'; - -import styles from './styles.module.scss'; - -interface CreatePostProps { - avatarUrl?: string; - isSubmitting?: boolean; - - onSubmit: (message: string) => void; -} - -export const CreatePost = ({ avatarUrl, isSubmitting, onSubmit }: CreatePostProps) => { - const [value, setValue] = useState(''); - const isDisabled = !value.trim() || isSubmitting; - - const handleOnChange = (event: React.ChangeEvent) => { - setValue(event.target.value); - }; - - const handleKeyDown = (event: React.KeyboardEvent) => { - if (!event.shiftKey && event.key === Key.Enter) { - event.preventDefault(); - handleOnSubmit(); - } - }; - - const handleOnSubmit = () => { - if (value.trim()) { - onSubmit(value); - setValue(''); - } - }; - - return ( -
-
- -
-
-
- - {isSubmitting && ( - - )} - - -
-
-
-
- -
-
-
- ); -}; - -interface PostInputProps { - onChange: (event: React.ChangeEvent) => void; - onKeyDown: (event: React.KeyboardEvent) => void; - value: string; -} - -const PostInput = ({ onChange, onKeyDown, value }: PostInputProps) => { - const ref = useRef(null); - - useEffect(() => { - if (ref.current) { - ref.current.style.height = 'auto'; - ref.current.style.height = `${ref.current.scrollHeight}px`; - - // Auto-resize on input - ref.current.addEventListener('input', () => { - ref.current.style.height = 'auto'; - ref.current.style.height = `${ref.current.scrollHeight}px`; - }); - } - }, []); - - return ( -