diff --git a/packages/react/src/views/AttachmentPreview/AttachmentPreview.js b/packages/react/src/views/AttachmentPreview/AttachmentPreview.js index 2c007f1a7..08bcd4b14 100644 --- a/packages/react/src/views/AttachmentPreview/AttachmentPreview.js +++ b/packages/react/src/views/AttachmentPreview/AttachmentPreview.js @@ -1,6 +1,13 @@ import React, { useContext, useState, useRef } from 'react'; import { css } from '@emotion/react'; -import { Box, Icon, Button, Input, Modal } from '@embeddedchat/ui-elements'; +import { + Box, + Icon, + Button, + Input, + Modal, + useTheme, +} from '@embeddedchat/ui-elements'; import useAttachmentWindowStore from '../../store/attachmentwindow'; import CheckPreviewType from './CheckPreviewType'; import RCContext from '../../context/RCInstance'; @@ -8,12 +15,12 @@ import { useMessageStore, useMemberStore } from '../../store'; import getAttachmentPreviewStyles from './AttachmentPreview.styles'; import { parseEmoji } from '../../lib/emoji'; import MembersList from '../Mentions/MembersList'; -import TypingUsers from '../TypingUsers/TypingUsers'; import useSearchMentionUser from '../../hooks/useSearchMentionUser'; const AttachmentPreview = () => { const { RCInstance, ECOptions } = useContext(RCContext); const styles = getAttachmentPreviewStyles(); + const { theme } = useTheme(); const toggle = useAttachmentWindowStore((state) => state.toggle); const data = useAttachmentWindowStore((state) => state.data); @@ -86,46 +93,71 @@ const AttachmentPreview = () => { css={css` text-align: center; margin-top: 1rem; + display: flex; + justify-content: center; + padding: 0 50px 0 50px; `} > - File name - + { handleFileName(e); }} value={fileName} - css={styles.input} - placeholder="name" + id="file-name" + css={css` + ${styles.input} + &: focus { + ${fileName === '' + ? `border: 1px solid red;` + : `border: 1px solid #000;`} + transition: border 0.1s ease-in; + } + `} /> - + {fileName === '' && ( + + The field File name is required. + + )} - File description - + {showMembersList && ( @@ -147,8 +179,14 @@ const AttachmentPreview = () => { onChange={(e) => { handleFileDescription(e); }} - css={styles.input} - placeholder="Description" + css={css` + ${styles.input} + &:focus { + border: 1.2px solid ${theme.colors.ring}; + transition: border 0.9s ease-in, border 0.9s ease-out; + } + `} + id="file-description" ref={messageRef} /> @@ -159,16 +197,19 @@ const AttachmentPreview = () => {