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

fixed tooltip position on mobile #2436

Merged
merged 3 commits into from
Dec 1, 2024
Merged
Changes from 2 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
96 changes: 48 additions & 48 deletions frontend/views/containers/dashboard/SentenceWithMemberTooltip.vue
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
<template lang="pug">
component(
is='Tooltip'
:key='members.length'
:opacity='members.length === 0 ? 0 : 0.95'
triggerElementSelector='.t-trigger'
direction='bottom-right'
)
// The reason for using <component /> tag here instead of <tooltip /> and specifying 'key' attr is,
// to fix the bug where the link between the tooltip content(template(slot='tooltip') below) and the trigger target element(.t-trigger)
// gets broken when "members" prop is updated. Tooltip gets destoryed and re-mounted in response to the prop change this way.
slot

template(v-if='members && members.length' slot='tooltip')
.c-member-name(
v-for='(name, index) in members'
:key='`member-${index}`'
)
.has-ellipsis {{ name }}
</template>

<script>
import Tooltip from '@components/Tooltip.vue'

export default ({
name: 'SentenceWithMemberTooltip',
components: {
Tooltip
},
props: {
members: Array
}
}: Object)
</script>

<style lang="scss" scoped>
.has-zero-members ::v-deep .c-tooltip {
display: none !important;
}

.c-member-name {
// Turn the parent element into flex-box to render ellipsis style properly.
position: relative;
display: flex;
flex-direction: column;
align-items: stretch;
}
</style>
<template lang="pug">
component(
is='Tooltip'
:key='members.length'
:opacity='members.length === 0 ? 0 : 0.95'
triggerElementSelector='.t-trigger'
direction='bottom-middle'
)
// The reason for using <component /> tag here instead of <tooltip /> and specifying 'key' attr is,
// to fix the bug where the link between the tooltip content(template(slot='tooltip') below) and the trigger target element(.t-trigger)
// gets broken when "members" prop is updated. Tooltip gets destoryed and re-mounted in response to the prop change this way.
slot
template(v-if='members && members.length' slot='tooltip')
.c-member-name(
v-for='(name, index) in members'
:key='`member-${index}`'
)
.has-ellipsis {{ name }}
</template>
<script>
import Tooltip from '@components/Tooltip.vue'
export default ({
name: 'SentenceWithMemberTooltip',
components: {
Tooltip
},
props: {
members: Array
}
}: Object)
</script>
<style lang="scss" scoped>
.has-zero-members ::v-deep .c-tooltip {
display: none !important;
}
.c-member-name {
// Turn the parent element into flex-box to render ellipsis style properly.
position: relative;
display: flex;
flex-direction: column;
align-items: stretch;
}
</style>