Skip to content
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
16 changes: 15 additions & 1 deletion src/components/NcUserBubble/NcUserBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default {
<component :is="isLinkComponent"
class="user-bubble__content"
:style="styles.content"
:to="to"
:href="hasUrl ? url : null"
:class="{ 'user-bubble__content--primary': primary }"
v-bind="attrs"
Expand Down Expand Up @@ -108,6 +109,7 @@ import NcUserBubbleDiv from './NcUserBubbleDiv.vue'
import NcAvatar from '../NcAvatar/index.js'
import NcPopover from '../NcPopover/index.js'
import Vue from 'vue'
import { RouterLink } from 'vue-router'

export default {
name: 'NcUserBubble',
Expand Down Expand Up @@ -160,6 +162,13 @@ export default {
}
},
},
/**
* Use bubble as a router-link for in-app navigation
*/
to: {
type: [String, Object],
default: undefined,
},
/**
* Default popover state. Requires the UserBubble
* to have some content to render inside the popover
Expand Down Expand Up @@ -240,7 +249,9 @@ export default {
},

isLinkComponent() {
return this.hasUrl ? 'a' : 'div'
return this.hasUrl
? (this.to ? RouterLink : 'a')
: 'div'
Copy link
Contributor Author

@Antreesy Antreesy Aug 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved your suggestions, thanks!
I kept only RouterLink support, and cursor styling for anchors.

Can we address this in follow-up, maybe? or <a role="button"> would suffice?

Suggested change
: 'div'
: (this.popoverEmpty ? 'div' : 'button')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's do it in a follow up. It is not a part of the original issue. TBH I even don't remember, where we use use bubble with popover...

},

popoverEmpty() {
Expand Down Expand Up @@ -329,4 +340,7 @@ export default {
}
}

a.user-bubble__content {
cursor: pointer;
}
</style>