-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed tooltip position on mobile (#2436)
* fixed tooltip position on mobile * fix * fixed reference
- Loading branch information
Showing
1 changed file
with
48 additions
and
48 deletions.
There are no files selected for viewing
96 changes: 48 additions & 48 deletions
96
frontend/views/containers/dashboard/SentenceWithMemberTooltip.vue
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 |
---|---|---|
@@ -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' | ||
) | ||
// 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> |