From e354abb3b50c4d093eaec8085c3aea53048ccd7d Mon Sep 17 00:00:00 2001 From: Shubham Vaidya Date: Thu, 21 Nov 2024 22:11:00 +0530 Subject: [PATCH] fix: create a new component for form-header used in each step (#310) https://github.com/eclipse-tractusx/portal-frontend-registration/issues/309 --- CHANGELOG.md | 4 +++ src/components/StepHeader.tsx | 41 +++++++++++++++++++++++++ src/components/cax-companyData.tsx | 17 ++++------ src/components/cax-companyRole.tsx | 17 ++++------ src/components/cax-responsibilities.tsx | 17 ++++------ src/components/dragdrop.tsx | 17 ++++------ src/components/verifyRegistration.tsx | 17 ++++------ 7 files changed, 75 insertions(+), 55 deletions(-) create mode 100644 src/components/StepHeader.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b7416cf..559f431b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bugfix + +- created a new component for form header to avoid duplication of code in each step [#310](https://github.com/eclipse-tractusx/portal-frontend-registration/pull/310) + ## 2.1.0-RC1 ### Change diff --git a/src/components/StepHeader.tsx b/src/components/StepHeader.tsx new file mode 100644 index 00000000..c8a623f3 --- /dev/null +++ b/src/components/StepHeader.tsx @@ -0,0 +1,41 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +type StepHeaderProps = { + step: number + stepName: string + stepDescription: string +} +const StepHeader = ({ step, stepName, stepDescription }: StepHeaderProps) => { + return ( +
+
+ {step} +
+

+ {stepName} +

+
+ {stepDescription} +
+
+ ) +} + +export default StepHeader diff --git a/src/components/cax-companyData.tsx b/src/components/cax-companyData.tsx index 2b8b050f..b8ce2e4e 100644 --- a/src/components/cax-companyData.tsx +++ b/src/components/cax-companyData.tsx @@ -43,6 +43,7 @@ import { import { Autocomplete, TextField } from '@mui/material' import i18n from '../services/I18nService' import { Notify } from './Snackbar' +import StepHeader from './StepHeader' type CountryType = { id: string @@ -389,17 +390,11 @@ export const CompanyDataCax = () => { return ( <>
-
-
- 1 -
-

- {t('registrationStepOne.verifyCompayDataHeading')} -

-
- {t('registrationStepOne.verifyCompayDataSubHeading')} -
-
+
diff --git a/src/components/cax-companyRole.tsx b/src/components/cax-companyRole.tsx index 8ca45cd3..b41c1d73 100644 --- a/src/components/cax-companyRole.tsx +++ b/src/components/cax-companyRole.tsx @@ -40,6 +40,7 @@ import { getCurrentStep, } from '../state/features/user/userApiSlice' import '../styles/newApp.css' +import StepHeader from './StepHeader' export const CompanyRoleCax = () => { const { t, i18n } = useTranslation() @@ -272,17 +273,11 @@ export const CompanyRoleCax = () => { return ( <>
-
-
- 3 -
-

- {t('companyRole.title')} -

-
- {t('companyRole.subTitle')} -
-
+
{allConsentData?.companyRoles.map((role, index) => (
diff --git a/src/components/cax-responsibilities.tsx b/src/components/cax-responsibilities.tsx index a8aa175d..31e0758a 100644 --- a/src/components/cax-responsibilities.tsx +++ b/src/components/cax-responsibilities.tsx @@ -38,6 +38,7 @@ import { useUpdateInviteNewUserMutation, } from '../state/features/applicationInviteUser/applicationInviteUserApiSlice' import { Notify, SeverityType } from './Snackbar' +import StepHeader from './StepHeader' export const ResponsibilitiesCax = () => { const { t } = useTranslation() @@ -177,17 +178,11 @@ export const ResponsibilitiesCax = () => { return ( <>
-
-
- 2 -
-

- {t('Responsibility.responsAndAdmin')} -

-
- {t('Responsibility.subTitle')} -
-
+
{ switch (status) { @@ -198,17 +199,11 @@ export const DragDrop = () => { return ( <>
-
-
- 4 -
-

- {t('documentUpload.title')} -

-
- {t('documentUpload.subTitle')} -
-
+
{ const { t } = useTranslation() @@ -107,17 +108,11 @@ export const VerifyRegistration = () => { return ( <>
-
-
- 5 -
-

- {t('verifyRegistration.title')} -

-
- {t('verifyRegistration.subtitle')} -
-
+