From a88193aeee39b9b1409848f82f3ef954f405104b Mon Sep 17 00:00:00 2001 From: igorrCarvalho Date: Thu, 30 May 2024 17:09:26 -0300 Subject: [PATCH] Refactor: Create function to get style classes --- .../IOModal/components/chatView/fileComponent/index.tsx | 7 ++++--- .../chatView/fileComponent/utils/get-classes.tsx | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/frontend/src/modals/IOModal/components/chatView/fileComponent/utils/get-classes.tsx diff --git a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx index 413f75e23..8c6fee7e9 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx @@ -9,6 +9,7 @@ import { BACKEND_URL, BASE_URL_API } from "../../../../../constants/constants"; import formatFileName from "../filePreviewChat/utils/format-file-name"; import DownloadButton from "./components/downloadButton/downloadButton"; import handleDownload from "./utils/handle-download"; +import getClasses from "./utils/get-classes"; const imgTypes = new Set(["png", "jpg"]); @@ -27,6 +28,8 @@ export default function FileCard({ setIsHovered(false); } + const fileWrapperClasses = getClasses(isHovered); + const imgSrc = `${BACKEND_URL.slice(0, BACKEND_URL.length - 1)}${BASE_URL_API}files/images/${content}`; if (showFile) { @@ -55,9 +58,7 @@ export default function FileCard({ return (
handleDownload({ fileName, content })} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} diff --git a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/utils/get-classes.tsx b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/utils/get-classes.tsx new file mode 100644 index 000000000..4e9b2416f --- /dev/null +++ b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/utils/get-classes.tsx @@ -0,0 +1,5 @@ +export default function getClasses(isHovered: boolean): string { + return `relative ${false ? "h-20 w-20" : "h-20 w-80"} cursor-pointer rounded-lg border border-ring bg-muted shadow transition duration-300 hover:drop-shadow-lg ${ + isHovered ? "shadow-md" : "" + }`; +}