From da64ef22554bdf25bf94ad38d0e2595a54cb57b4 Mon Sep 17 00:00:00 2001 From: benzbarquilla Date: Sat, 28 Feb 2026 20:52:41 +0800 Subject: [PATCH] done create credentials --- frontend/src/app/credentials/add/page.jsx | 60 +++++++++++-------- .../src/app/credentials/add/styles.module.css | 13 +++- 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/credentials/add/page.jsx b/frontend/src/app/credentials/add/page.jsx index 5ab13b1..4aac044 100644 --- a/frontend/src/app/credentials/add/page.jsx +++ b/frontend/src/app/credentials/add/page.jsx @@ -5,22 +5,30 @@ import globalStyle from "../../globalStyle.module.css"; import createCredStyle from "./styles.module.css"; import TopToolTip from "@/app/components/topToolTip/TopToolTip"; import TextField from "@/app/components/fields/textfield"; +import Prompts from "@/app/components/prompts/Prompts"; const Page = () => { - const fileInputRef = useRef(null); - const [fileName, setFileName] = useState(""); - - const handleClick = () => { - fileInputRef.current.click(); - }; - + const [selectedFile, setSelectedFile] = useState(null); + // Click const handleFileChange = (e) => { const file = e.target.files[0]; if (file) { - setFileName(file.name); - console.log(file); // you can send this to backend later + setSelectedFile(file); + console.log(file); //send this to backend later } }; + // Drag/Drop + const handleDrop = (e) => { + e.preventDefault(); + + const file = e.dataTransfer.files[0]; + if (file) { + setSelectedFile(file); + } + }; + const handleDragOver = (e) => { + e.preventDefault(); + }; return (
@@ -44,6 +52,7 @@ const Page = () => { {/* Content */}
+
{/* Upload File */} @@ -51,24 +60,25 @@ const Page = () => { {/* Label */}

Upload File

+ {/* Optional or Required */} + {/*

(Optional)

*/}{" "}
- - {/* Hidden File Input */} - - - {/* Custom Upload Box */} -
- {fileName ? ( -

{fileName}

+ + {selectedFile ? ( +

+ {/* Display file name only */} + {selectedFile.name} +

) : ( <>

@@ -79,7 +89,7 @@ const Page = () => {

)} -
+
diff --git a/frontend/src/app/credentials/add/styles.module.css b/frontend/src/app/credentials/add/styles.module.css index 0e35953..8ed202a 100644 --- a/frontend/src/app/credentials/add/styles.module.css +++ b/frontend/src/app/credentials/add/styles.module.css @@ -77,8 +77,18 @@ align-self: stretch; border-radius: 4px; border: 1px dashed #5980f1; - border: 1px dashed color(display-p3 0.3804 0.4959 0.9137); + border: 2px dashed color(display-p3 0.3804 0.4959 0.9137); + cursor: pointer; } +.upload:hover { + background: rgba(129, 135, 255, 0.25); + background: color(display-p3 0.5098 0.5294 1 / 0.25); +} +.upload:hover .chooseTxt { + color: #fff; + color: color(display-p3 1 1 1); +} + .chooseTxt { color: #5980f1; color: color(display-p3 0.3804 0.4959 0.9137); @@ -90,6 +100,7 @@ line-height: normal; align-self: stretch; } + .dragTxt { color: #85869b; color: color(display-p3 0.5216 0.5255 0.6);