-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
YKI(Frontend): Replace use of tabs in header with navigation links [d…
…eploy]
- Loading branch information
Showing
7 changed files
with
85 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
frontend/packages/yki/src/components/layouts/publicHeader/PublicNavTabs.tsx
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
frontend/packages/yki/src/components/layouts/publicHeader/PublicNavigationLinks.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { matchPath, useLocation } from 'react-router-dom'; | ||
import { NavigationLinks } from 'shared/components'; | ||
|
||
import { useCommonTranslation } from 'configs/i18n'; | ||
import { AppRoutes, HeaderTabNav } from 'enums/app'; | ||
|
||
const getTabForPath = (path: string) => { | ||
if ( | ||
path === AppRoutes.Registration || | ||
matchPath(AppRoutes.ExamSession, path) || | ||
matchPath(AppRoutes.ExamSessionRegistration, path) || | ||
matchPath(AppRoutes.RegistrationPaymentStatus, path) | ||
) { | ||
return HeaderTabNav.Registration; | ||
} else if ( | ||
path === AppRoutes.Reassessment || | ||
matchPath(AppRoutes.ReassessmentOrder, path) || | ||
matchPath(AppRoutes.ReassessmentOrderStatus, path) | ||
) { | ||
return HeaderTabNav.Reassessment; | ||
} else { | ||
return false; | ||
} | ||
}; | ||
|
||
export const PublicNavigationLinks = () => { | ||
const translateCommon = useCommonTranslation(); | ||
const { pathname } = useLocation(); | ||
|
||
return ( | ||
<NavigationLinks | ||
navigationAriaLabel={translateCommon( | ||
'header.accessibility.mainNavigation', | ||
)} | ||
links={[ | ||
{ | ||
active: getTabForPath(pathname) === HeaderTabNav.Registration, | ||
href: AppRoutes.Registration, | ||
label: translateCommon(HeaderTabNav.Registration), | ||
}, | ||
{ | ||
active: getTabForPath(pathname) === HeaderTabNav.Reassessment, | ||
href: AppRoutes.Reassessment, | ||
label: translateCommon(HeaderTabNav.Reassessment), | ||
}, | ||
]} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters