-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breadcrumb devsite #167
Merged
Merged
Breadcrumb devsite #167
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ff954c3
breadcrumbs base
Rajandeep98 e4b3867
responsive breadcrum
Rajandeep98 0a0ae65
fix imports
Rajandeep98 684ea27
screen setup for breadcrumbs
Rajandeep98 ed1af92
added divider
Rajandeep98 5ab7d1d
breadcrumb compute
Rajandeep98 01fd2ed
breadcrumb Name Update
Rajandeep98 afcc0f0
updated computation
Rajandeep98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script setup lang="ts"> | ||
import type { BreadcrumbLink } from '#ui/types' | ||
const { t } = useI18n() | ||
const route = useRoute() | ||
|
||
const breadcrumbs = computed<BreadcrumbLink[]>(() => | ||
route.meta.breadcrumbs || [{ label: t('sbcBreadcrumb.default') }] | ||
) | ||
|
||
const resolveBackHref = computed(() => { | ||
const bc = breadcrumbs.value | ||
return bc.length > 1 ? bc[bc.length - 2]?.to || bc[bc.length - 2]?.href : '' | ||
}) | ||
|
||
const isBackButtonDisabled = computed(() => breadcrumbs.value.length <= 2) | ||
|
||
</script> | ||
<template> | ||
<div class="2xl: left-1 bg-bcGovColor-nonClickable sm:px-4"> | ||
<div class="m-auto flex w-full max-w-[1312px] items-center justify-between"> | ||
<div class="flex h-10 min-h-10 items-center"> | ||
<UButton | ||
class="mr-3 mt-px size-[28px] rounded-full px-1 text-blue-500" | ||
color="white" | ||
:disabled="isBackButtonDisabled" | ||
icon="i-mdi-arrow-left" | ||
:aria-label="$t('sbcBreadcrumb.backBtn')" | ||
data-cy="crumb-back" | ||
:to="resolveBackHref" | ||
/> | ||
<span class="text-white">|</span> | ||
<UBreadcrumb | ||
:links="breadcrumbs" | ||
:aria-label="$t('sbcBreadcrumb.arialabel')" | ||
class="flex min-w-0 flex-wrap items-center gap-x-1.5 pl-3 text-xs leading-6 text-white" | ||
:ui="{ | ||
li: 'flex items-center gap-x-1.5 text-xs text-white leading-6 min-w-0', | ||
base: 'flex items-center gap-x-1.5 group font-normal min-w-0', | ||
label: 'block truncate tracking-wide', | ||
active: 'text-white', | ||
inactive: 'text-white underline hover:text-white', | ||
icon: { | ||
base: 'flex-shrink-0 w-3 h-3 text-white', | ||
active: '', | ||
inactive: '', | ||
}, | ||
}" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: 'https://bcregistry.gov.bc.ca/' } | ||
] | ||
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.sbcProductslist'), 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.sbcProducts'), to: localePath('/products/get-started') }) | ||
} | ||
|
||
return bc | ||
}) | ||
return breadcrumbs | ||
} |
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
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,5 @@ | ||
import type { BreadcrumbLink } from '#ui/types' | ||
export function setBreadcrumbs (breadcrumbs: BreadcrumbLink[]) { | ||
const route = useRoute() | ||
route.meta.breadcrumbs = breadcrumbs | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this line?
You can do like this:
const bc = [
{ label: t('sbcBreadcrumb.default'), to: 'https://bcregistry.gov.bc.ca/' },
{ label: t('sbcBreadcrumb.sbcHome'), to: '/' }
]