From 2beaa007a14f7dbe8c4bcea2de01d1377c0b9899 Mon Sep 17 00:00:00 2001
From: Piyush Bhatt <2023kuec2027@iiitkota.ac.in>
Date: Tue, 14 Jan 2025 23:32:16 +0530
Subject: [PATCH 1/3] initial commit
---
.../AttachmentPreview/AttachmentPreview.js | 64 ++++++++++++++-----
1 file changed, 47 insertions(+), 17 deletions(-)
diff --git a/packages/react/src/views/AttachmentPreview/AttachmentPreview.js b/packages/react/src/views/AttachmentPreview/AttachmentPreview.js
index 2c007f1a7..f2d29beed 100644
--- a/packages/react/src/views/AttachmentPreview/AttachmentPreview.js
+++ b/packages/react/src/views/AttachmentPreview/AttachmentPreview.js
@@ -1,6 +1,6 @@
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 +8,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 +86,67 @@ const AttachmentPreview = () => {
css={css`
text-align: center;
margin-top: 1rem;
+ padding: 0 100px 0 100px;
`}
>
-
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 +168,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 +186,19 @@ const AttachmentPreview = () => {