diff --git a/frontend/src/app/components/alerts/Alert.jsx b/frontend/src/app/components/alerts/Alert.jsx new file mode 100644 index 0000000..7fc417d --- /dev/null +++ b/frontend/src/app/components/alerts/Alert.jsx @@ -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 ( +
+
+
+
+ +
+

Create New Service

+
+
+

+ You are about to add a new record. Please review the details before + continuing. Do you want to proceed? +

+
+
+ + +
+
+
+ ); +}; + +export default Alert; diff --git a/frontend/src/app/components/alerts/styles.module.css b/frontend/src/app/components/alerts/styles.module.css new file mode 100644 index 0000000..f27d70b --- /dev/null +++ b/frontend/src/app/components/alerts/styles.module.css @@ -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; +} diff --git a/frontend/src/app/components/icons/boxedCheck.jsx b/frontend/src/app/components/icons/boxedCheck.jsx new file mode 100644 index 0000000..294ded0 --- /dev/null +++ b/frontend/src/app/components/icons/boxedCheck.jsx @@ -0,0 +1,35 @@ +const BoxedCheckIcon = ({ + width = 24, + height = 24, + color = "white", + strokeWidth = 2, + ...props +}) => { + return ( + + + + + ); +}; + +export default BoxedCheckIcon; diff --git a/frontend/src/app/components/topHeader/TopHeader.jsx b/frontend/src/app/components/topHeader/TopHeader.jsx index 12a55eb..1db9e0b 100644 --- a/frontend/src/app/components/topHeader/TopHeader.jsx +++ b/frontend/src/app/components/topHeader/TopHeader.jsx @@ -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,100 +24,109 @@ const TopHeader = (props) => { router.push(`${pathName}/add`); }; return ( -
-
- {((pathName.includes("/view") && props.state === "view") || - params.usersId || - params.roleId) && ( -
router.back()}> - -
- )} -

{props.topbarTitle}

-
-
- {(pathName === "/projects/view" || !props.state) && ( -
- -
- )} - {pathName === "/credentials" ? ( -
- -

Manage Env. Key

-
- ) : ( - "" - )} - {pathName === "/projects/view" && ( -
props.trigger(!props.triggerState)} - > - -

{props.buttonText}

-
- )} - {!props.state && ( -
- -

{props.buttonText}

-
- )} - {props.state === "add" ? ( - <> -
- + <> + {triggerAlert && } +
+
+ {((pathName.includes("/view") && props.state === "view") || + params.usersId || + params.rolesId) && ( +
router.back()}> + +
+ )} +

{props.topbarTitle}

+
+
+ {(pathName === "/projects/view" || !props.state) && ( +
+ +
+ )} + {pathName === "/credentials" ? ( +
+ +

Manage Env. Key

+
+ ) : ( + "" + )} + {pathName === "/projects/view" && ( +
props.trigger(!props.triggerState)} + > +

{props.buttonText}

-
router.back()}> -

{props.cancelButtonText}

+ )} + {!props.state && ( +
+ +

{props.buttonText}

- - ) : ( - "" - )} - {/* Projects 3 dots menu */} - {pathName === "/projects/view" && ( -
setTriggerDropDownMenu(!triggerDropDownMenu)} - > -
- -
- {triggerDropDownMenu && ( -
-
-
- -

Clone Project

-
-
-
-
- -

Robots

-
-
-
-
- -

Init Key

-
-
-
-
- -

Manage Env. Key

-
-
+ )} + {props.state === "add" ? ( + <> +
setTriggerAlert(!triggerAlert)} + > + +

{props.buttonText}

- )} -
- )} +
router.back()} + > +

{props.cancelButtonText}

+
+ + ) : ( + "" + )} + {/* Projects 3 dots menu */} + {pathName === "/projects/view" && ( +
setTriggerDropDownMenu(!triggerDropDownMenu)} + > +
+ +
+ {triggerDropDownMenu && ( +
+
+
+ +

Clone Project

+
+
+
+
+ +

Robots

+
+
+
+
+ +

Init Key

+
+
+
+
+ +

Manage Env. Key

+
+
+
+ )} +
+ )} +
-
+ ); }; diff --git a/frontend/src/app/components/topHeader/styles.module.css b/frontend/src/app/components/topHeader/styles.module.css index e109419..ffdcd7b 100644 --- a/frontend/src/app/components/topHeader/styles.module.css +++ b/frontend/src/app/components/topHeader/styles.module.css @@ -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%);