Compare commits

..

2 Commits

2 changed files with 87 additions and 88 deletions

View File

@@ -1,10 +1,26 @@
import React from "react"; "use client";
import React, { useRef, useState } from "react";
import TopHeader from "@/app/components/topHeader/TopHeader"; import TopHeader from "@/app/components/topHeader/TopHeader";
import globalStyle from "../../globalStyle.module.css"; import globalStyle from "../../globalStyle.module.css";
import createCredStyle from "./styles.module.css"; import createCredStyle from "./styles.module.css";
import TopToolTip from "@/app/components/topToolTip/TopToolTip"; import TopToolTip from "@/app/components/topToolTip/TopToolTip";
import TextField from "@/app/components/fields/textfield";
const page = () => { const Page = () => {
const fileInputRef = useRef(null);
const [fileName, setFileName] = useState("");
const handleClick = () => {
fileInputRef.current.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
}
};
return ( return (
<div className={globalStyle.section}> <div className={globalStyle.section}>
<div className={globalStyle.mainContainer}> <div className={globalStyle.mainContainer}>
@@ -27,13 +43,42 @@ const page = () => {
</div> </div>
{/* Content */} {/* Content */}
<div className={createCredStyle.credInputField}> <div className={createCredStyle.credInputField}>
<TextField placeHolder="Enter Credential Name" />
</div>
</div>
{/* Upload File */}
<div className={createCredStyle.uploadFile}>
{/* Label */}
<div className={createCredStyle.label}>
<p>Upload File</p>
</div>
{/* Hidden File Input */}
<input <input
type="text" type="file"
name="" ref={fileInputRef}
id="" onChange={handleFileChange}
placeholder="Enter Email" style={{ display: "none" }}
className={createCredStyle.placeholderTxt}
/> />
{/* Custom Upload Box */}
<div
className={createCredStyle.upload}
onClick={handleClick}
style={{ cursor: "pointer" }}
>
{fileName ? (
<p>{fileName}</p>
) : (
<>
<p className={createCredStyle.chooseTxt}>
Click to choose a file
</p>
<p className={createCredStyle.dragTxt}>
Drag or drop here
</p>
</>
)}
</div> </div>
</div> </div>
</div> </div>
@@ -44,4 +89,4 @@ const page = () => {
); );
}; };
export default page; export default Page;

View File

@@ -50,100 +50,54 @@
gap: 8px; gap: 8px;
align-self: stretch; align-self: stretch;
} }
.uploadFile {
.credInputField > p {
display: flex; display: flex;
height: 44px;
padding: 12px 16px;
flex-direction: column; flex-direction: column;
justify-content: center;
align-items: flex-start; align-items: flex-start;
background: none; gap: 12px;
gap: 10px;
align-self: stretch; align-self: stretch;
border-radius: 6px;
border: 1px solid #616583;
border: 1px solid color(display-p3 0.3843 0.3961 0.5057);
} }
.label > .optionalTxt {
.credInputField > input:hover {
border: 1px solid #616583;
border: 1px solid color(display-p3 0.3843 0.3961 0.5057);
background: rgba(75, 79, 109, 0.05);
background: color(display-p3 0.298 0.3098 0.4196 / 0.05);
}
.credInputField input:focus {
outline: none;
border-radius: 6px;
border: 1px solid #959aff;
border: 1px solid color(display-p3 0.5892 0.6031 0.9766);
background: rgba(75, 79, 109, 0.25);
background: color(display-p3 0.298 0.3098 0.4196 / 0.25);
caret-color: #959aff;
}
.credInputField input:focus::placeholder {
color: #4b4f6d;
color: color(display-p3 0.298 0.3098 0.4196);
}
.placeholderTxt::placeholder {
color: #85869b; color: #85869b;
color: color(display-p3 0.5216 0.5255 0.6); color: color(display-p3 0.5216 0.5255 0.6);
font-family: Inter; font-family: Inter;
font-size: 16 px;
font-style: normal;
font-weight: 300;
line-height: normal;
}
.upload {
display: flex;
height: 203px;
padding: 12px;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 10px;
align-self: stretch;
border-radius: 4px;
border: 1px dashed #5980f1;
border: 1px dashed color(display-p3 0.3804 0.4959 0.9137);
}
.chooseTxt {
color: #5980f1;
color: color(display-p3 0.3804 0.4959 0.9137);
text-align: center;
font-family: Inter;
font-size: 16px; font-size: 16px;
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
line-height: normal; line-height: normal;
}
/*
.inputField {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8px;
align-self: stretch; align-self: stretch;
} }
.inputField > input { .dragTxt {
display: flex;
height: 44px;
padding: 12px 16px;
flex-direction: column;
justify-content: center;
align-items: flex-start;
background: none;
gap: 10px;
align-self: stretch;
border-radius: 6px;
border: 1px solid #616583;
border: 1px solid color(display-p3 0.3843 0.3961 0.5057);
}
.inputField > input:hover {
border: 1px solid #616583;
border: 1px solid color(display-p3 0.3843 0.3961 0.5057);
background: rgba(75, 79, 109, 0.05);
background: color(display-p3 0.298 0.3098 0.4196 / 0.05);
}
.inputField input:focus {
outline: none;
border-radius: 6px;
border: 1px solid #959aff;
border: 1px solid color(display-p3 0.5892 0.6031 0.9766);
background: rgba(75, 79, 109, 0.25);
background: color(display-p3 0.298 0.3098 0.4196 / 0.25);
caret-color: #959aff;
}
.inputField input:focus::placeholder {
color: #4b4f6d;
color: color(display-p3 0.298 0.3098 0.4196);
}
.placeholderTxt::placeholder {
color: #85869b; color: #85869b;
color: color(display-p3 0.5216 0.5255 0.6); color: color(display-p3 0.5216 0.5255 0.6);
text-align: center;
font-family: Inter; font-family: Inter;
font-size: 16px; font-size: 14px;
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
line-height: normal; */ line-height: normal;
align-self: stretch;
}