From ff954c33341c408323fad8485526d689d7f79899 Mon Sep 17 00:00:00 2001 From: Rajandeep Date: Fri, 29 Nov 2024 12:41:41 -0800 Subject: [PATCH 1/8] breadcrumbs base --- web/site/app/app.vue | 3 +- web/site/app/components/Sbc/Breadcrumb.vue | 57 ++++++++++++++++++++++ web/site/app/composables/sbcBreadcrumb.ts | 25 ++++++++++ web/site/app/locales/en-CA.ts | 8 +++ web/site/app/pages/index.vue | 11 ++++- web/site/app/pages/products/[...slug].vue | 12 +++++ web/site/app/pages/products/index.vue | 10 ++++ web/site/app/utils/setBreadcrumb.ts | 5 ++ web/site/nuxt.config.ts | 6 +++ 9 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 web/site/app/components/Sbc/Breadcrumb.vue create mode 100644 web/site/app/composables/sbcBreadcrumb.ts create mode 100644 web/site/app/utils/setBreadcrumb.ts diff --git a/web/site/app/app.vue b/web/site/app/app.vue index 192a03b1..768b75d7 100644 --- a/web/site/app/app.vue +++ b/web/site/app/app.vue @@ -1,5 +1,5 @@ + diff --git a/web/site/app/composables/sbcBreadcrumb.ts b/web/site/app/composables/sbcBreadcrumb.ts new file mode 100644 index 00000000..a0371bd4 --- /dev/null +++ b/web/site/app/composables/sbcBreadcrumb.ts @@ -0,0 +1,25 @@ +import { computed } from 'vue' + +export function useBreadcrumbs () { + const { t } = useI18n() + const route = useRoute() + const localePath = useLocalePath() + + const breadcrumbs = computed(() => { + const bc = [ + { label: t('sbcBreadcrumb.default'), to: '/' } + ] + bc.push({ label: t('sbcBreadcrumb.sbcHome'), to: '/' }) + // Check for /products + if (route.path.includes('/products') && !route.path.includes('/get-started')) { + bc.push({ label: t('sbcBreadcrumb.sbcProducts'), to: localePath('/products') }) + } + // Check for /products/get-started and include sub-paths like /account-setup + if (route.path.includes('/products/get-started')) { + bc.push({ label: t('sbcBreadcrumb.sbcDocs'), to: localePath('/products/get-started') }) + } + + return bc + }) + return breadcrumbs +} diff --git a/web/site/app/locales/en-CA.ts b/web/site/app/locales/en-CA.ts index 75c307a5..a59afd4f 100644 --- a/web/site/app/locales/en-CA.ts +++ b/web/site/app/locales/en-CA.ts @@ -20,6 +20,14 @@ export default { openMainNav: 'Open Main Navigation Menu', closeMainNav: 'Close Main Navigation Menu' }, + sbcBreadcrumb: { + default: 'BC Registries and Digital Service', + backBtn: 'Go Back', + arialabel: 'Breadcrumb', + sbcHome: 'Service BC Connect', + sbcProducts: 'Products', + sbcDocs: 'Documentation' + }, page: { notFound: { h1: 'Page Not Found' diff --git a/web/site/app/pages/index.vue b/web/site/app/pages/index.vue index b0281fc5..b446bd3f 100644 --- a/web/site/app/pages/index.vue +++ b/web/site/app/pages/index.vue @@ -1,9 +1,18 @@