Add feature
This commit is contained in:
38
frontend/src/app/components/alerts/Alert.jsx
Normal file
38
frontend/src/app/components/alerts/Alert.jsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import React, { useState } from "react";
|
||||
import styles from "./styles.module.css";
|
||||
import BoxedCheckIcon from "../icons/boxedCheck";
|
||||
const Alert = (props) => {
|
||||
const [hide, setHide] = useState(false);
|
||||
const handleHide = () => {
|
||||
setHide(true);
|
||||
setTimeout(() => {
|
||||
props.setTriggerAlert(false);
|
||||
}, 250);
|
||||
};
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div
|
||||
className={`${styles.alertContainer} ${hide ? styles.hide : styles.show}`}
|
||||
>
|
||||
<div className={styles.headers}>
|
||||
<div className={styles.iconContainer}>
|
||||
<BoxedCheckIcon />
|
||||
</div>
|
||||
<p>Create New Service</p>
|
||||
</div>
|
||||
<div className={styles.alertBody}>
|
||||
<p>
|
||||
You are about to add a new record. Please review the details before
|
||||
continuing. Do you want to proceed?
|
||||
</p>
|
||||
</div>
|
||||
<div className={styles.actionButtons}>
|
||||
<button onClick={handleHide}>Confirm</button>
|
||||
<button onClick={handleHide}>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Alert;
|
||||
130
frontend/src/app/components/alerts/styles.module.css
Normal file
130
frontend/src/app/components/alerts/styles.module.css
Normal file
@@ -0,0 +1,130 @@
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #00000037;
|
||||
}
|
||||
.alertContainer {
|
||||
display: flex;
|
||||
width: 449px;
|
||||
padding: 24px 16px 16px 16px;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
border-radius: 14px;
|
||||
background: #21232f;
|
||||
animation-name: showAlert;
|
||||
animation-duration: 0.3s;
|
||||
}
|
||||
.show {
|
||||
animation-name: showAlert;
|
||||
animation-duration: 0.3s;
|
||||
}
|
||||
.hide {
|
||||
animation-name: hideAlert;
|
||||
animation-duration: 0.3s;
|
||||
}
|
||||
|
||||
@keyframes showAlert {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: scale(0.7);
|
||||
}
|
||||
75% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
@keyframes hideAlert {
|
||||
0% {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
75% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: scale(0.7);
|
||||
}
|
||||
}
|
||||
.headers {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
align-self: stretch;
|
||||
}
|
||||
.iconContainer {
|
||||
display: flex;
|
||||
padding: 12px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
border-radius: 50%;
|
||||
background: #2e305f;
|
||||
}
|
||||
.headers > p {
|
||||
color: #fff;
|
||||
font-family: Inter;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
line-height: normal;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
.alertBody {
|
||||
display: flex;
|
||||
padding: 12px 0;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
align-self: stretch;
|
||||
}
|
||||
.body > p {
|
||||
color: #fff;
|
||||
font-family: Inter;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
line-height: 20px;
|
||||
}
|
||||
.actionButtons {
|
||||
display: flex;
|
||||
padding-top: 12px;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
gap: 10px;
|
||||
align-self: stretch;
|
||||
}
|
||||
.actionButtons > button {
|
||||
display: flex;
|
||||
height: 36px;
|
||||
padding: 8px 16px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex: 1 0 0;
|
||||
border-radius: 6px;
|
||||
border: 0.5px solid #8187ff;
|
||||
background: rgba(83, 89, 242, 0.25);
|
||||
color: #fff;
|
||||
font-family: Inter;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
.actionButtons > button:nth-child(2) {
|
||||
border-radius: 6px;
|
||||
border: 0.5px solid #4e537e;
|
||||
background-color: transparent;
|
||||
}
|
||||
35
frontend/src/app/components/icons/boxedCheck.jsx
Normal file
35
frontend/src/app/components/icons/boxedCheck.jsx
Normal file
@@ -0,0 +1,35 @@
|
||||
const BoxedCheckIcon = ({
|
||||
width = 24,
|
||||
height = 24,
|
||||
color = "white",
|
||||
strokeWidth = 2,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={width}
|
||||
height={height}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M3 5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5Z"
|
||||
stroke={color}
|
||||
strokeWidth={strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M9 12L11 14L15 10"
|
||||
stroke={color}
|
||||
strokeWidth={strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
export default BoxedCheckIcon;
|
||||
@@ -12,9 +12,11 @@ import CloneIcon from "../icons/clone";
|
||||
import RobotIcon from "../icons/robot";
|
||||
import KeyIcon from "../icons/key";
|
||||
import ManageEnvIcon from "../icons/manageEnv";
|
||||
import Alert from "../alerts/Alert";
|
||||
|
||||
const TopHeader = (props) => {
|
||||
const [triggerDropDownMenu, setTriggerDropDownMenu] = useState(false);
|
||||
const [triggerAlert, setTriggerAlert] = useState(false);
|
||||
const pathName = usePathname();
|
||||
const router = useRouter();
|
||||
const params = useParams();
|
||||
@@ -22,11 +24,13 @@ const TopHeader = (props) => {
|
||||
router.push(`${pathName}/add`);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
{triggerAlert && <Alert setTriggerAlert={setTriggerAlert} />}
|
||||
<div className={styles.container}>
|
||||
<div className={styles.title}>
|
||||
{((pathName.includes("/view") && props.state === "view") ||
|
||||
params.usersId ||
|
||||
params.roleId) && (
|
||||
params.rolesId) && (
|
||||
<div onClick={() => router.back()}>
|
||||
<BackIcon />
|
||||
</div>
|
||||
@@ -64,11 +68,17 @@ const TopHeader = (props) => {
|
||||
)}
|
||||
{props.state === "add" ? (
|
||||
<>
|
||||
<div className={styles.button}>
|
||||
<div
|
||||
className={styles.button}
|
||||
onClick={() => setTriggerAlert(!triggerAlert)}
|
||||
>
|
||||
<CheckIcon width={20} height={20} />
|
||||
<p>{props.buttonText}</p>
|
||||
</div>
|
||||
<div className={styles.cancelButton} onClick={() => router.back()}>
|
||||
<div
|
||||
className={styles.cancelButton}
|
||||
onClick={() => router.back()}
|
||||
>
|
||||
<p>{props.cancelButtonText}</p>
|
||||
</div>
|
||||
</>
|
||||
@@ -116,6 +126,7 @@ const TopHeader = (props) => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
border-radius: 6px;
|
||||
border: 0.5px solid #8187ff;
|
||||
background: rgba(83, 89, 242, 0.25);
|
||||
cursor: pointer;
|
||||
}
|
||||
.button:hover {
|
||||
background: linear-gradient(180deg, #5359f2 0%, #2e3288 100%);
|
||||
|
||||
Reference in New Issue
Block a user