diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 3fb67862..684eea87 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -22,6 +22,7 @@ "react-tabs": "^6.0.2", "react-timer-hook": "^3.0.7", "typescript": "^4.9.5", + "vertical-stepper-nav": "^1.0.2", "web-vitals": "^2.1.4" }, "scripts": { diff --git a/packages/frontend/src/components/Stepper.tsx b/packages/frontend/src/components/Stepper.tsx new file mode 100644 index 00000000..996cab95 --- /dev/null +++ b/packages/frontend/src/components/Stepper.tsx @@ -0,0 +1,49 @@ +import React from 'react'; +import { StepperNav } from 'vertical-stepper-nav'; + +const COLOR_COMPLETED = '#059669'; +const COLOR_ACTIVE = '#CFE6FC'; +const COLOR_NOT_STARTED = '#F1F5F9'; + +interface StepperValue { + step: number; + route: string; + label: string; +} + +interface StepperProps { + activeStep: number; + stepperValues: StepperValue[]; +} + +const Stepper = ({ activeStep, stepperValues }: StepperProps) => { + return ( + { + return { + stepContent: () => ( +
+ {stepperValue.label} +
+ ), + stepStatusCircleSize: 30, + stepStateColor: `${ + activeStep > stepperValue.step + ? COLOR_COMPLETED + : activeStep === stepperValue.step + ? COLOR_ACTIVE + : COLOR_NOT_STARTED + }`, + }; + })} + /> + ); +}; + +export default Stepper; diff --git a/packages/frontend/src/components/projects/create/template/deploy/CancelDeploymentDialog.tsx b/packages/frontend/src/components/projects/create/template/deploy/CancelDeploymentDialog.tsx index e3ab096c..ead37649 100644 --- a/packages/frontend/src/components/projects/create/template/deploy/CancelDeploymentDialog.tsx +++ b/packages/frontend/src/components/projects/create/template/deploy/CancelDeploymentDialog.tsx @@ -38,7 +38,7 @@ const CancelDeploymentDialog = ({ - + diff --git a/packages/frontend/src/pages/projects/create/Template.tsx b/packages/frontend/src/pages/projects/create/Template.tsx index 199a68f2..544e700c 100644 --- a/packages/frontend/src/pages/projects/create/Template.tsx +++ b/packages/frontend/src/pages/projects/create/Template.tsx @@ -1,7 +1,23 @@ -import React from 'react'; -import { Outlet } from 'react-router-dom'; +import React, { useMemo } from 'react'; +import { Outlet, useLocation } from 'react-router-dom'; + +import Stepper from '../../../components/Stepper'; + +const STEPPER_VALUES = [ + { step: 1, route: '/projects/create/template', label: 'Create repository' }, + { step: 2, route: '/projects/create/template/deploy', label: 'Deploy' }, +]; const CreateWithTemplate = () => { + const location = useLocation(); + + const activeStep = useMemo( + () => + STEPPER_VALUES.find((data) => data.route === location.pathname)?.step ?? + 0, + [location.pathname], + ); + return (
@@ -11,8 +27,7 @@ const CreateWithTemplate = () => {
-
1 Create repository
-
2 Deploy
+
diff --git a/packages/frontend/src/pages/projects/create/template/Deploy.tsx b/packages/frontend/src/pages/projects/create/template/Deploy.tsx index ec2e8770..c968dfef 100644 --- a/packages/frontend/src/pages/projects/create/template/Deploy.tsx +++ b/packages/frontend/src/pages/projects/create/template/Deploy.tsx @@ -30,7 +30,7 @@ const Deploy = () => {
diff --git a/yarn.lock b/yarn.lock index 685c9863..c4a039e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5488,7 +5488,7 @@ eslint-plugin-jest@^25.3.0: dependencies: "@typescript-eslint/experimental-utils" "^5.0.0" -eslint-plugin-jsx-a11y@^6.5.1: +eslint-plugin-jsx-a11y@^6.4.1, eslint-plugin-jsx-a11y@^6.5.1: version "6.8.0" resolved "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.8.0.tgz" integrity sha512-Hdh937BS3KdwwbBaKd5+PLCOmYY6U4f2h9Z2ktwtNKvIdIEu137rjYbcb9ApSbVJfWxANNuiKTD/9tOKjK9qOA== @@ -12312,6 +12312,13 @@ vary@~1.1.2: resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== +vertical-stepper-nav@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/vertical-stepper-nav/-/vertical-stepper-nav-1.0.2.tgz#788e057a8b59bc9073e87f422d231f78f87f307b" + integrity sha512-lCOcD2hGS7W9jOy/LIFMZU1/EgBFpSOyf78IqEsGGPcES6FrMMK3oh9HszxeUCE5X8c9q/RKl3bvmHOcuK4lSQ== + dependencies: + eslint-plugin-jsx-a11y "^6.4.1" + w3c-hr-time@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz"