Skip to content
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

Made only the active breadcrumb take active color #4009

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/ui/src/components/va-breadcrumbs/VaBreadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export default defineComponent({
...useAlignProps,
...useComponentPresetProp,
separator: { type: String, default: '/' },
color: { type: String, default: 'secondary' },
color: { type: String, default: null },
disabledColor: { type: String, default: 'secondary' },
activeColor: { type: String, default: null },
separatorColor: { type: String, default: null },
ariaLabel: { type: String, default: '$t:breadcrumbs' },
Expand All @@ -22,10 +23,11 @@ export default defineComponent({

const { getColor } = useColors()
const computedThemesSeparatorColor = computed(() => {
return props.separatorColor ? getColor(props.separatorColor) : getColor(props.color)
return props.separatorColor ? getColor(props.separatorColor) : null
})
const computedThemesColor = computed(() => props.color ? getColor(props.color) : null)
const computedThemesActiveColor = computed(() => {
return props.activeColor ? getColor(props.activeColor) : getColor(props.color)
return props.activeColor ? getColor(props.activeColor) : null
})

const childNodeFilter = (result: VNode[], node: VNode) => {
Expand Down Expand Up @@ -81,10 +83,12 @@ export default defineComponent({

const createChildComponent = (child: VNode, index: number) => h(
'span', {
class: 'va-breadcrumbs__item',
class: ['va-breadcrumbs__item', { 'va-breadcrumbs__item--disabled': isDisabledChild(child) }],
'aria-current': (isLastIndexChildNodes(index) && isChildLink(child)) ? 'location' : false,
style: {
color: (!isLastIndexChildNodes(index) && !isDisabledChild(child)) ? computedThemesActiveColor.value : null,
color: isDisabledChild(child)
? getColor(props.disabledColor)
: isLastIndexChildNodes(index) ? computedThemesActiveColor.value : computedThemesColor.value,
},
},
[child],
Expand Down
Loading